URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 996 to Rev 997
- ↔ Reverse comparison
Rev 996 → Rev 997
/trunk/or1ksim/mprofiler.c
24,6 → 24,7
#include <malloc.h> |
#include "support/profile.h" |
#include "mprofiler.h" |
#include "sim-config.h" |
|
struct memory_hash { |
struct memory_hash *next; |
45,15 → 46,15
|
void mp_help () |
{ |
printf ("mprofiler <-d|-p|-a|-w> [-f filename] [-g group] from to\n"); |
printf ("\t-d\t--detail\t\tdetailed output\n"); |
printf ("\t-p\t--pretty\t\tpretty output\n"); |
printf ("\t-a\t--access\t\toutput accesses only\n"); |
printf ("\t-w\t--width\t\t\toutput by width\n"); |
printf ("\t-f\t--filename filename\tspecify mprofile file [sim.mprofile]\n"); |
printf ("\t-g\t--group bits\t\tgroup 2^bits successive\n"); |
printf ("\t\t\t\t\taddresses together [2]\n"); |
printf ("\t-h\t--help\t\t\toutput this screen\n"); |
PRINTF ("mprofiler <-d|-p|-a|-w> [-f filename] [-g group] from to\n"); |
PRINTF ("\t-d\t--detail\t\tdetailed output\n"); |
PRINTF ("\t-p\t--pretty\t\tpretty output\n"); |
PRINTF ("\t-a\t--access\t\toutput accesses only\n"); |
PRINTF ("\t-w\t--width\t\t\toutput by width\n"); |
PRINTF ("\t-f\t--filename filename\tspecify mprofile file [sim.mprofile]\n"); |
PRINTF ("\t-g\t--group bits\t\tgroup 2^bits successive\n"); |
PRINTF ("\t\t\t\t\taddresses together [2]\n"); |
PRINTF ("\t-h\t--help\t\t\toutput this screen\n"); |
} |
|
void hash_add (unsigned long addr, int index) |
98,7 → 99,7
int index; |
unsigned t = buf[i].type; |
if (t > 64) { |
printf ("!"); |
PRINTF ("!"); |
t = 0; |
} |
if (mode == MODE_WIDTH) t >>= 3; |
110,7 → 111,7
case 4: index = 2; break; |
default: |
index = 0; |
printf ("!!!!"); |
PRINTF ("!!!!"); |
break; |
} |
hash_add (buf[i].addr >> group_bits, index); |
136,44 → 137,44
void printout (int mode) |
{ |
unsigned long addr = start_addr & ~((1 << group_bits) - 1); |
printf ("start = %08x (%08x); end = %08x; group_bits = %08x\n", start_addr, addr, end_addr, (1 << group_bits) - 1); |
PRINTF ("start = %08x (%08x); end = %08x; group_bits = %08x\n", start_addr, addr, end_addr, (1 << group_bits) - 1); |
for (; addr <= end_addr; addr += (1 << group_bits)) { |
int i; |
unsigned long a = hash_get (addr >> group_bits, 0); |
unsigned long b = hash_get (addr >> group_bits, 1); |
unsigned long c = hash_get (addr >> group_bits, 2); |
printf ("%08x:", addr); |
PRINTF ("%08x:", addr); |
switch (mode) { |
case MODE_DETAIL: |
if (a) printf (" %10i R", a); |
else printf (" R"); |
if (b) printf (" %10i W", b); |
else printf (" W"); |
if (c) printf (" %10i F", c); |
else printf (" F"); |
if (a) PRINTF (" %10i R", a); |
else PRINTF (" R"); |
if (b) PRINTF (" %10i W", b); |
else PRINTF (" W"); |
if (c) PRINTF (" %10i F", c); |
else PRINTF (" F"); |
break; |
case MODE_ACCESS: |
printf (" %10i", a + b + c); |
PRINTF (" %10i", a + b + c); |
break; |
case MODE_PRETTY: |
printf (" %10i ", a + b + c); |
PRINTF (" %10i ", a + b + c); |
for (i = 0; i < nbits (a + b + c); i++) |
printf ("#"); |
PRINTF ("#"); |
#if 0 |
for (; i < 64; i++) |
printf ("."); |
PRINTF ("."); |
#endif |
break; |
case MODE_WIDTH: |
if (a) printf (" %10i B", a); |
else printf (" B"); |
if (b) printf (" %10i H", b); |
else printf (" H"); |
if (c) printf (" %10i W", c); |
else printf (" W"); |
if (a) PRINTF (" %10i B", a); |
else PRINTF (" B"); |
if (b) PRINTF (" %10i H", b); |
else PRINTF (" H"); |
if (c) PRINTF (" %10i W", c); |
else PRINTF (" W"); |
break; |
} |
printf ("\n"); |
PRINTF ("\n"); |
if (addr >= addr + (1 << group_bits)) break; /* Overflow? */ |
} |
} |
/trunk/or1ksim/sim-config.h
282,6 → 282,7
FILE *fmprof; /* Memory profiler file */ |
FILE *fexe_log; /* RTL state comparison file */ |
FILE *fspr_log; /* SPR state log file */ |
FILE *fout; /* file for standard output */ |
int init; /* Whether we are still initilizing sim */ |
int script_file_specified; /* Whether script file was already loaded */ |
char *filename; /* Original Command Simulator file (CZ) */ |
346,6 → 347,8
#define IFF(x) if (1) |
#endif |
|
#define PRINTF(x...) fprintf (runtime.sim.fout, x) |
|
extern struct runtime runtime; |
|
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead. */ |
/trunk/or1ksim/debug/debug_unit.c.bak
304,7 → 304,7
int DebugGetRegister(unsigned int address,int32_t* data) |
{ |
int err; |
printf("Debug get register %x\n",address); |
PRINTF("Debug get register %x\n",address); |
fflush(stdout); |
switch(current_scan_chain) |
{ |
319,7 → 319,7
err = GetDevelopmentInterfaceRegister(address,data); |
break; |
} |
printf("!get reg %x\n", *data); |
PRINTF("!get reg %x\n", *data); |
fflush(stdout); |
return err; |
} |
327,7 → 327,7
int DebugSetRegister(unsigned int address,int32_t data) |
{ |
int err; |
printf("Debug set register %x <- %x\n",address, data); |
PRINTF("Debug set register %x <- %x\n",address, data); |
fflush(stdout); |
switch(current_scan_chain) |
{ |
341,7 → 341,7
err = SetDevelopmentInterfaceRegister(address,data); |
break; |
} |
printf("!set reg\n"); |
PRINTF("!set reg\n"); |
fflush(stdout); |
return err; |
} |
348,7 → 348,7
|
int DebugSetChain(int chain) |
{ |
printf("Debug set chain %x\n",chain); |
PRINTF("Debug set chain %x\n",chain); |
fflush(stdout); |
switch(chain) |
{ |
361,7 → 361,7
return JTAG_PROXY_INVALID_CHAIN; |
} |
|
printf("!set chain\n"); |
PRINTF("!set chain\n"); |
fflush(stdout); |
return 0; |
} |
519,7 → 519,7
case DEBUGINT_DVR5: |
case DEBUGINT_DVR6: |
case DEBUGINT_DVR7: |
printf("DVR %d set to 0x%08x\n",address-DEBUGINT_DVR0,value); |
PRINTF("DVR %d set to 0x%08x\n",address-DEBUGINT_DVR0,value); |
SET_REG32(debug_unit.DVR[address-DEBUGINT_DVR0],value); |
break; |
case DEBUGINT_DCR0: |
530,7 → 530,7
case DEBUGINT_DCR5: |
case DEBUGINT_DCR6: |
case DEBUGINT_DCR7: |
printf("DCR %d set to 0x%08x\n",address-DEBUGINT_DCR0,value); |
PRINTF("DCR %d set to 0x%08x\n",address-DEBUGINT_DCR0,value); |
SET_REG32(debug_unit.DCR[address-DEBUGINT_DCR0],value); |
break; |
case DEBUGINT_DMR1: |
/trunk/or1ksim/debug/debug_unit.c
210,7 → 210,7
{ |
int err; |
#ifdef DEBUG_JTAG |
printf("Debug get register %x\n",address); |
PRINTF("Debug get register %x\n",address); |
fflush(stdout); |
#endif |
switch(current_scan_chain) |
234,7 → 234,7
break; |
} |
#ifdef DEBUG_JTAG |
printf("!get reg %x\n", *data); |
PRINTF("!get reg %x\n", *data); |
fflush(stdout); |
#endif |
return err; |
244,7 → 244,7
{ |
int err; |
#ifdef DEBUG_JTAG |
printf("Debug set register %x <- %x\n", address, data); |
PRINTF("Debug set register %x <- %x\n", address, data); |
fflush(stdout); |
#endif |
switch(current_scan_chain) |
267,7 → 267,7
break; |
} |
#ifdef DEBUG_JTAG |
printf("!set reg\n"); |
PRINTF("!set reg\n"); |
fflush(stdout); |
#endif |
return err; |
276,7 → 276,7
int DebugSetChain(int chain) |
{ |
#ifdef DEBUG_JTAG |
printf("Debug set chain %x\n",chain); |
PRINTF("Debug set chain %x\n",chain); |
fflush(stdout); |
#endif |
switch(chain) |
292,7 → 292,7
} |
|
#ifdef DEBUG_JTAG |
printf("!set chain\n"); |
PRINTF("!set chain\n"); |
fflush(stdout); |
#endif |
return 0; |
338,7 → 338,7
break; |
} |
#ifdef DEBUG_JTAG |
printf("set_devint_reg %08x = %08x\n", address, data); |
PRINTF("set_devint_reg %08x = %08x\n", address, data); |
fflush(stdout); |
#endif |
return err; |
371,7 → 371,7
} |
|
#ifdef DEBUG_JTAG |
printf("get_devint_reg %08x = %08x\n", address, value); |
PRINTF("get_devint_reg %08x = %08x\n", address, value); |
fflush(stdout); |
#endif |
*data = value; |
435,7 → 435,7
&debug_ignore_exception; |
|
#if DEBUG_JTAG |
printf ("dsr 0x%08x drr 0x%08x \n", dsr, drr); |
PRINTF ("dsr 0x%08x drr 0x%08x \n", dsr, drr); |
#endif |
|
switch(except) { |
456,7 → 456,7
break; |
} |
#if DEBUG_JTAG |
printf ("dsr 0x%08x drr 0x%08x result %i\n", dsr, drr, result); |
PRINTF ("dsr 0x%08x drr 0x%08x result %i\n", dsr, drr, result); |
#endif |
|
mtspr (SPR_DRR, drr); |
/trunk/or1ksim/debug/gdbcomm.c
654,7 → 654,7
{ |
serverPort = config.debug.server_port; |
if(server_fd = GetServerSocket("or1ksim","tcp",serverPort)) |
printf("JTAG Proxy server started on port %d\n",serverPort); |
PRINTF("JTAG Proxy server started on port %d\n",serverPort); |
else |
printf("Cannot start JTAG proxy server on port %d\n", serverPort); |
PRINTF("Cannot start JTAG proxy server on port %d\n", serverPort); |
} |
/trunk/or1ksim/cpu/Makefile.in
1,6 → 1,6
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
145,7 → 145,7
dot_seen=no; \ |
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ |
rev="$$subdir $$rev"; \ |
test "$$subdir" = "." && dot_seen=yes; \ |
test "$$subdir" != "." || dot_seen=yes; \ |
done; \ |
test "$$dot_seen" = "no" && rev=". $$rev"; \ |
target=`echo $@ | sed s/-recursive//`; \ |
/trunk/or1ksim/cpu/or32/Makefile.in
1,6 → 1,6
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
108,10 → 108,10
libarch_a_SOURCES = execute.c or32.c |
|
@SIMPLE_EXECUTION_TRUE@noinst_PROGRAMS = |
@SIMPLE_EXECUTION_FALSE@noinst_PROGRAMS = generate |
@SIMPLE_EXECUTION_FALSE@noinst_PROGRAMS = @SIMPLE_EXECUTION_FALSE@generate |
@SIMPLE_EXECUTION_TRUE@generate_SOURCES = |
@SIMPLE_EXECUTION_FALSE@generate_SOURCES = or32.c generate.c |
@SIMPLE_EXECUTION_FALSE@BUILT_SOURCES = execgen.c |
@SIMPLE_EXECUTION_FALSE@generate_SOURCES = @SIMPLE_EXECUTION_FALSE@or32.c generate.c |
@SIMPLE_EXECUTION_FALSE@BUILT_SOURCES = @SIMPLE_EXECUTION_FALSE@execgen.c |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
CONFIG_HEADER = ../../config.h |
CONFIG_CLEAN_FILES = |
/trunk/or1ksim/cpu/or32/execute.c
110,7 → 110,7
if (regno < MAX_GPRS) { |
return reg[regno]; |
} else { |
printf("\nABORT: read out of registers\n"); |
PRINTF("\nABORT: read out of registers\n"); |
runtime.sim.cont_run = 0; |
return 0; |
} |
127,7 → 127,7
if (regno < MAX_GPRS) { |
reg[regno] = value; |
} else { |
printf("\nABORT: write out of registers\n"); |
PRINTF("\nABORT: write out of registers\n"); |
runtime.sim.cont_run = 0; |
} |
} |
145,7 → 145,7
#endif /* RAW_RANGE */ |
return reg[regno]; |
} else { |
printf("\nABORT: read out of registers\n"); |
PRINTF("\nABORT: read out of registers\n"); |
runtime.sim.cont_run = 0; |
return 0; |
} |
158,13 → 158,13
{ |
#if 0 |
if (strcmp(regstr, FRAME_REG) == 0) { |
printf("FP (%s) modified by insn at %x. ", FRAME_REG, pc); |
printf("Old:%.8lx New:%.8lx\n", eval_reg(regno), value); |
PRINTF("FP (%s) modified by insn at %x. ", FRAME_REG, pc); |
PRINTF("Old:%.8lx New:%.8lx\n", eval_reg(regno), value); |
} |
|
if (strcmp(regstr, STACK_REG) == 0) { |
printf("SP (%s) modified by insn at %x. ", STACK_REG, pc); |
printf("Old:%.8lx New:%.8lx\n", eval_reg(regmo), value); |
PRINTF("SP (%s) modified by insn at %x. ", STACK_REG, pc); |
PRINTF("Old:%.8lx New:%.8lx\n", eval_reg(regmo), value); |
} |
#endif |
|
174,7 → 174,7
raw_stats.reg[regno] = runtime.sim.cycles; |
#endif /* RAW_RANGE */ |
} else { |
printf("\nABORT: write out of registers\n"); |
PRINTF("\nABORT: write out of registers\n"); |
runtime.sim.cont_run = 0; |
} |
} |
367,8 → 367,8
sbuf_total_cyc += cyc; |
sbuf_prev_cycles = runtime.sim.cycles; |
|
//printf (">STORE %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//printf ("|%i,%i\n", sbuf_total_cyc, sbuf_wait_cyc); |
//PRINTF (">STORE %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//PRINTF ("|%i,%i\n", sbuf_total_cyc, sbuf_wait_cyc); |
/* Take stores from buffer, that occured meanwhile */ |
while (sbuf_count && delta >= sbuf_buf[sbuf_tail]) { |
delta -= sbuf_buf[sbuf_tail]; |
390,7 → 390,7
sbuf_buf[sbuf_head] = cyc; |
sbuf_head = (sbuf_head + 1) % MAX_SBUF_LEN; |
sbuf_count++; |
//printf ("|STORE %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//PRINTF ("|STORE %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
} |
|
/* Store buffer analysis - previous stores should commit, before any load */ |
398,8 → 398,8
int delta = runtime.sim.cycles - sbuf_prev_cycles; |
sbuf_prev_cycles = runtime.sim.cycles; |
|
//printf (">LOAD %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//printf ("|%i,%i\n", sbuf_total_cyc, sbuf_wait_cyc); |
//PRINTF (">LOAD %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//PRINTF ("|%i,%i\n", sbuf_total_cyc, sbuf_wait_cyc); |
/* Take stores from buffer, that occured meanwhile */ |
while (sbuf_count && delta >= sbuf_buf[sbuf_tail]) { |
delta -= sbuf_buf[sbuf_tail]; |
417,7 → 417,7
sbuf_tail = (sbuf_tail + 1) % MAX_SBUF_LEN; |
sbuf_count--; |
} |
//printf ("|LOAD %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
//PRINTF ("|LOAD %i,%i,%i,%i,%i\n", delta, sbuf_count, sbuf_tail, sbuf_head, sbuf_buf[sbuf_tail], sbuf_buf[sbuf_head]); |
} |
|
/* Outputs dissasembled instruction */ |
485,23 → 485,23
|
dumpmemory(iqueue[0].insn_addr, iqueue[0].insn_addr + 4, 1, 0); |
generate_time_pretty (temp, runtime.sim.cycles * config.sim.clkcycle_ps); |
printf(" (executed) [time %s, #%i]\n", temp, runtime.cpu.instructions); |
PRINTF(" (executed) [time %s, #%i]\n", temp, runtime.cpu.instructions); |
if (config.cpu.superscalar) |
printf ("Superscalar CYCLES: %u", runtime.cpu.supercycles); |
PRINTF ("Superscalar CYCLES: %u", runtime.cpu.supercycles); |
if (config.cpu.hazards) |
printf (" HAZARDWAIT: %u\n", runtime.cpu.hazardwait); |
PRINTF (" HAZARDWAIT: %u\n", runtime.cpu.hazardwait); |
else |
if (config.cpu.superscalar) |
printf ("\n"); |
PRINTF ("\n"); |
|
dumpmemory(pc, pc + 4, 1, 0); |
printf(" (next insn) %s", (delay_insn?"(delay insn)":"")); |
PRINTF(" (next insn) %s", (delay_insn?"(delay insn)":"")); |
for(i = 0; i < MAX_GPRS; i++) { |
if (i % 4 == 0) |
printf("\n"); |
printf("GPR%.2u: %.8lx ", i, evalsim_reg32(i)); |
PRINTF("\n"); |
PRINTF("GPR%.2u: %.8lx ", i, evalsim_reg32(i)); |
} |
printf("flag: %u\n", flag); |
PRINTF("flag: %u\n", flag); |
} |
|
/* Generated/built in decoding/executing function */ |
559,7 → 559,7
mtspr(SPR_SR, config.cpu.sr); |
|
pcnext = 0x0; /* MM1409: All programs should start at reset vector entry! */ |
if (config.sim.verbose) printf ("Starting at 0x%08x\n", pcnext); |
if (config.sim.verbose) PRINTF ("Starting at 0x%08x\n", pcnext); |
pc = pcnext; |
pc_phy = pc; |
pcnext += 4; |
573,7 → 573,7
inline int cpu_clock () |
{ |
if(fetch()) { |
printf ("Breakpoint hit.\n"); |
PRINTF ("Breakpoint hit.\n"); |
runtime.sim.cont_run = 0; /* memory breakpoint encountered */ |
return 1; |
} |
/trunk/or1ksim/cpu/or32/insnset.c
145,7 → 145,7
IFF (config.cpu.dependstats) current->func_unit = it_arith; |
set_operand32(0, set_ov_flag ((signed long)eval_operand32(1, &breakpoint) * (signed long)eval_operand32(2, &breakpoint)), &breakpoint); |
/*if (!(mcount++ & 1023)) { |
printf ("[%i]\n",mcount); |
PRINTF ("[%i]\n",mcount); |
}*/ |
} |
INSTRUCTION (l_div) { |
270,7 → 270,7
case NOP_NOP: |
break; |
case NOP_EXIT: |
printf("exit(%d)\n", evalsim_reg32 (3)); |
PRINTF("exit(%d)\n", evalsim_reg32 (3)); |
if (config.debug.gdb_enabled) |
set_stall_state (1); |
else |
282,10 → 282,10
debug(5, "simprintf %x\n", stackaddr); |
break; |
case NOP_REPORT: |
printf("report(0x%x);\n", evalsim_reg32(3)); |
PRINTF("report(0x%x);\n", evalsim_reg32(3)); |
default: |
if (k >= NOP_REPORT_FIRST && k <= NOP_REPORT_LAST) |
printf("report %i (0x%x);\n", k - NOP_REPORT_FIRST, evalsim_reg32(3)); |
PRINTF("report %i (0x%x);\n", k - NOP_REPORT_FIRST, evalsim_reg32(3)); |
break; |
} |
} |
387,7 → 387,7
if (mfspr(SPR_SR) & SPR_SR_SM) |
mtspr(regno, value); |
else { |
printf("WARNING: trying to write SPR while SR[SUPV] is cleared.\n"); |
PRINTF("WARNING: trying to write SPR while SR[SUPV] is cleared.\n"); |
runtime.sim.cont_run = 0; |
} |
} |
404,7 → 404,7
set_operand32(0, value, &breakpoint); |
else { |
set_operand32(0, 0, &breakpoint); |
printf("WARNING: trying to read SPR while SR[SUPV] is cleared.\n"); |
PRINTF("WARNING: trying to read SPR while SR[SUPV] is cleared.\n"); |
runtime.sim.cont_run = 0; |
} |
} |
424,7 → 424,7
hi = mfspr (SPR_MACHI); |
x = eval_operand32(0, &breakpoint); |
y = eval_operand32(1, &breakpoint); |
printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y)); |
PRINTF ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y)); |
l = (ULONGEST)lo | ((LONGEST)hi << 32); |
l += (LONGEST) x * (LONGEST) y; |
|
433,7 → 433,7
hi = ((LONGEST)l) >> 32; |
mtspr (SPR_MACLO, lo); |
mtspr (SPR_MACHI, hi); |
printf ("(%08x,%08x)\n", hi, lo); |
PRINTF ("(%08x,%08x)\n", hi, lo); |
} |
INSTRUCTION (l_msb) { |
sprword lo, hi; |
444,7 → 444,7
hi = mfspr (SPR_MACHI); |
x = eval_operand32(0, &breakpoint); |
y = eval_operand32(1, &breakpoint); |
printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y)); |
PRINTF ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y)); |
l = (ULONGEST)lo | ((LONGEST)hi << 32); |
l -= (LONGEST) eval_operand32(0, &breakpoint) * (LONGEST)eval_operand32(1, &breakpoint); |
|
453,7 → 453,7
hi = ((LONGEST)l) >> 32; |
mtspr (SPR_MACLO, lo); |
mtspr (SPR_MACHI, hi); |
printf ("(%08x,%08x)\n", hi, lo); |
PRINTF ("(%08x,%08x)\n", hi, lo); |
} |
INSTRUCTION (l_macrc) { |
sprword lo, hi; |
464,7 → 464,7
hi = mfspr (SPR_MACHI); |
l = (ULONGEST) lo | ((LONGEST)hi << 32); |
l >>= 28; |
//printf ("<%08x>\n", (unsigned long)l); |
//PRINTF ("<%08x>\n", (unsigned long)l); |
set_operand32(0, (long)l, &breakpoint); |
mtspr (SPR_MACLO, 0); |
mtspr (SPR_MACHI, 0); |
/trunk/or1ksim/cpu/dlx/execute.c
72,7 → 72,7
if (regno < MAX_GPRS) |
return reg[regno]; |
else { |
printf("\nABORT: read out of registers\n"); |
PRINTF("\nABORT: read out of registers\n"); |
cont_run = 0; |
return 0; |
} |
93,7 → 93,7
if (regno < MAX_GPRS) |
reg[regno] = value; |
else { |
printf("\nABORT: write out of registers\n"); |
PRINTF("\nABORT: write out of registers\n"); |
cont_run = 0; |
} |
|
215,13 → 215,13
strcpy(operand, dstoperand); |
|
if (*operand == '#') /* immediate */ |
printf("INTERNAL ERROR: Can't set immediate operand.\n"); |
PRINTF("INTERNAL ERROR: Can't set immediate operand.\n"); |
else |
if (!strstr(operand, "(")) /* not indirect but ...*/ |
if (*operand == 'r') /* ... register direct */ |
set_reg32(operand, value); |
else /* ... rel. or abs. address */ |
printf("INTERNAL ERROR: Can't set addr operand.\n"); |
PRINTF("INTERNAL ERROR: Can't set addr operand.\n"); |
else { /* register indirect */ |
int disp; /* with possible displacement */ |
char *regstr; |
640,10 → 640,10
|
stackaddr = eval_reg(FRAME_REG); |
simprintf(stackaddr, 0); |
/* printf("simprintf %x %x %x\n", stackaddr, fmtaddr, args); */ |
/* PRINTF("simprintf %x %x %x\n", stackaddr, fmtaddr, args); */ |
} else { |
printf("\nABORT: illegal opcode %s ", cur->insn); |
printf("at %.8lx\n", cur->insn_addr); |
PRINTF("\nABORT: illegal opcode %s ", cur->insn); |
PRINTF("at %.8lx\n", cur->insn_addr); |
cont_run = 0; |
} |
|
739,16 → 739,16
{ |
int i; |
|
printf("\n\nIQ[0]:"); |
PRINTF("\n\nIQ[0]:"); |
dumpmemory(iqueue[0].insn_addr, iqueue[0].insn_addr + 4); |
printf(" (just executed)\tCYCLES: %u \nSuperscalar CYCLES: %u\n", cycles, supercycles); |
printf("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", loadcycles, storecycles); |
printf("Additional RESULT FORWARDING CYCLES: %u\nPC:", forwardingcycles); |
PRINTF(" (just executed)\tCYCLES: %u \nSuperscalar CYCLES: %u\n", cycles, supercycles); |
PRINTF("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", loadcycles, storecycles); |
PRINTF("Additional RESULT FORWARDING CYCLES: %u\nPC:", forwardingcycles); |
dumpmemory(pc, pc + 4); |
printf(" (next insn)"); |
PRINTF(" (next insn)"); |
for(i = 0; i < MAX_GPRS; i++) { |
if (i % 4 == 0) |
printf("\n"); |
printf("GPR%.2u: %.8lx ", i, reg[i]); |
PRINTF("\n"); |
PRINTF("GPR%.2u: %.8lx ", i, reg[i]); |
} |
} |
/trunk/or1ksim/cpu/common/stats.c
137,7 → 137,7
{ |
int i, all = 0, dependall = 0; |
|
printf ("\n"); |
PRINTF ("\n"); |
if (config.bpb.enabled) { |
struct branchstat bf; |
struct branchstat bnf; |
154,50 → 154,50
bnf.backward = mstats.bnf[0][0] + mstats.bf[1][0]; |
bnf_all = bnf.forward + bnf.backward; |
|
printf("bnf: %d (%d%%) taken,", bf.taken, (bf.taken * 100) / SD(bf_all)); |
printf(" %d (%d%%) not taken,", bf.nottaken, (bf.nottaken * 100) / SD(bf_all)); |
printf(" %d (%d%%) forward,", bf.forward, (bf.forward * 100) / SD(bf_all)); |
printf(" %d (%d%%) backward\n", bf.backward, (bf.backward * 100) / SD(bf_all)); |
printf("bf: %d (%d%%) taken,", bnf.taken, (bnf.taken * 100) / SD(bnf_all)); |
printf(" %d (%d%%) not taken,", bnf.nottaken, (bnf.nottaken * 100) / SD(bnf_all)); |
printf(" %d (%d%%) forward,", bnf.forward, (bnf.forward * 100) / SD(bnf_all)); |
printf(" %d (%d%%) backward\n", bnf.backward, (bnf.backward * 100) / SD(bnf_all)); |
PRINTF("bnf: %d (%d%%) taken,", bf.taken, (bf.taken * 100) / SD(bf_all)); |
PRINTF(" %d (%d%%) not taken,", bf.nottaken, (bf.nottaken * 100) / SD(bf_all)); |
PRINTF(" %d (%d%%) forward,", bf.forward, (bf.forward * 100) / SD(bf_all)); |
PRINTF(" %d (%d%%) backward\n", bf.backward, (bf.backward * 100) / SD(bf_all)); |
PRINTF("bf: %d (%d%%) taken,", bnf.taken, (bnf.taken * 100) / SD(bnf_all)); |
PRINTF(" %d (%d%%) not taken,", bnf.nottaken, (bnf.nottaken * 100) / SD(bnf_all)); |
PRINTF(" %d (%d%%) forward,", bnf.forward, (bnf.forward * 100) / SD(bnf_all)); |
PRINTF(" %d (%d%%) backward\n", bnf.backward, (bnf.backward * 100) / SD(bnf_all)); |
|
printf("StaticBP bnf(%s): correct %d%%\n", config.bpb.sbp_bnf_fwd ? "forward" : "backward", |
PRINTF("StaticBP bnf(%s): correct %d%%\n", config.bpb.sbp_bnf_fwd ? "forward" : "backward", |
(mstats.bnf[0][config.bpb.sbp_bnf_fwd] * 100) / SD(bnf_all)); |
printf("StaticBP bf(%s): correct %d%%\n", config.bpb.sbp_bf_fwd ? "forward" : "backward", |
PRINTF("StaticBP bf(%s): correct %d%%\n", config.bpb.sbp_bf_fwd ? "forward" : "backward", |
(mstats.bnf[1][config.bpb.sbp_bf_fwd] * 100) / SD(bf_all)); |
printf("BPB: hit %d (correct %d%%), miss %d\n", mstats.bpb.hit, (mstats.bpb.correct * 100) / SD(mstats.bpb.hit), mstats.bpb.miss); |
PRINTF("BPB: hit %d (correct %d%%), miss %d\n", mstats.bpb.hit, (mstats.bpb.correct * 100) / SD(mstats.bpb.hit), mstats.bpb.miss); |
} else |
printf("BPB simulation disabled. Enable it to see BPB analysis\n"); |
PRINTF("BPB simulation disabled. Enable it to see BPB analysis\n"); |
|
if (config.bpb.btic) { |
printf("BTIC: hit %d(%d%%), miss %d\n", mstats.btic.hit, (mstats.btic.hit * 100) / SD(mstats.btic.hit + mstats.btic.miss), mstats.btic.miss); |
PRINTF("BTIC: hit %d(%d%%), miss %d\n", mstats.btic.hit, (mstats.btic.hit * 100) / SD(mstats.btic.hit + mstats.btic.miss), mstats.btic.miss); |
} else |
printf("BTIC simulation disabled. Enabled it to see BTIC analysis\n"); |
PRINTF("BTIC simulation disabled. Enabled it to see BTIC analysis\n"); |
|
if (config.ic.enabled) { |
printf("IC read: hit %d(%d%%), miss %d\n", ic_stats.readhit, (ic_stats.readhit * 100) / SD(ic_stats.readhit + ic_stats.readmiss), ic_stats.readmiss); |
PRINTF("IC read: hit %d(%d%%), miss %d\n", ic_stats.readhit, (ic_stats.readhit * 100) / SD(ic_stats.readhit + ic_stats.readmiss), ic_stats.readmiss); |
} else |
printf("No ICache. Enable it to see IC results.\n"); |
PRINTF("No ICache. Enable it to see IC results.\n"); |
|
if (config.dc.enabled) { |
printf("DC read: hit %d(%d%%), miss %d\n", dc_stats.readhit, (dc_stats.readhit * 100) / SD(dc_stats.readhit + dc_stats.readmiss), dc_stats.readmiss); |
printf("DC write: hit %d(%d%%), miss %d\n", dc_stats.writehit, (dc_stats.writehit * 100) / SD(dc_stats.writehit + dc_stats.writemiss), dc_stats.writemiss); |
PRINTF("DC read: hit %d(%d%%), miss %d\n", dc_stats.readhit, (dc_stats.readhit * 100) / SD(dc_stats.readhit + dc_stats.readmiss), dc_stats.readmiss); |
PRINTF("DC write: hit %d(%d%%), miss %d\n", dc_stats.writehit, (dc_stats.writehit * 100) / SD(dc_stats.writehit + dc_stats.writemiss), dc_stats.writemiss); |
} else |
printf("No DCache. Enable it to see DC results.\n"); |
PRINTF("No DCache. Enable it to see DC results.\n"); |
|
if (testsprbits(SPR_UPR, SPR_UPR_IMP)) { |
printf("IMMU read: hit %d(%d%%), miss %d\n", immu_stats.fetch_tlbhit, (immu_stats.fetch_tlbhit * 100) / SD(immu_stats.fetch_tlbhit + immu_stats.fetch_tlbmiss), immu_stats.fetch_tlbmiss); |
PRINTF("IMMU read: hit %d(%d%%), miss %d\n", immu_stats.fetch_tlbhit, (immu_stats.fetch_tlbhit * 100) / SD(immu_stats.fetch_tlbhit + immu_stats.fetch_tlbmiss), immu_stats.fetch_tlbmiss); |
} else |
printf("No IMMU. Set UPR[IMP]\n"); |
PRINTF("No IMMU. Set UPR[IMP]\n"); |
|
if (testsprbits(SPR_UPR, SPR_UPR_DMP)) { |
printf("DMMU read: hit %d(%d%%), miss %d\n", dmmu_stats.loads_tlbhit, (dmmu_stats.loads_tlbhit * 100) / SD(dmmu_stats.loads_tlbhit + dmmu_stats.loads_tlbmiss), dmmu_stats.loads_tlbmiss); |
PRINTF("DMMU read: hit %d(%d%%), miss %d\n", dmmu_stats.loads_tlbhit, (dmmu_stats.loads_tlbhit * 100) / SD(dmmu_stats.loads_tlbhit + dmmu_stats.loads_tlbmiss), dmmu_stats.loads_tlbmiss); |
} else |
printf("No DMMU. Set UPR[DMP]\n"); |
PRINTF("No DMMU. Set UPR[DMP]\n"); |
|
printf("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", runtime.sim.loadcycles, runtime.sim.storecycles); |
PRINTF("Additional LOAD CYCLES: %u STORE CYCLES: %u\n", runtime.sim.loadcycles, runtime.sim.storecycles); |
} |
|
void printstats(int which) |
205,29 → 205,29
int i, all = 0, dependall = 0; |
|
if (which > 1 && which <= 5 && !config.cpu.dependstats) { |
printf("Hazard analysis disabled. Enable it to see analysis results.\n"); |
PRINTF("Hazard analysis disabled. Enable it to see analysis results.\n"); |
return; |
} |
|
switch (which) { |
case 1: |
printf("stats 1: Misc stats\n"); |
PRINTF("stats 1: Misc stats\n"); |
printotherstats(which); |
break; |
case 2: |
printf ("stats 2: Instruction usage\n"); |
PRINTF ("stats 2: Instruction usage\n"); |
for(i = 0; i < SSTATS_LEN; i++) |
all += sstats[i].cnt_dynamic; |
|
for(i = 0; i < SSTATS_LEN; i++) |
if (sstats[i].cnt_dynamic) |
printf(" %-15s used %6dx (%5.1f%%)\n", insn_name(sstats[i].insn), sstats[i].cnt_dynamic, (sstats[i].cnt_dynamic * 100.)/SD(all)); |
PRINTF(" %-15s used %6dx (%5.1f%%)\n", insn_name(sstats[i].insn), sstats[i].cnt_dynamic, (sstats[i].cnt_dynamic * 100.)/SD(all)); |
|
printf("%d instructions (dynamic, single stats)\n", all); |
PRINTF("%d instructions (dynamic, single stats)\n", all); |
break; |
|
case 3: |
printf ("stats 3: Instruction dependencies\n"); |
PRINTF ("stats 3: Instruction dependencies\n"); |
for(i = 0; i < DSTATS_LEN; i++) { |
all += dstats[i].cnt_dynamic; |
dependall += dstats[i].depend; |
237,15 → 237,15
if (dstats[i].cnt_dynamic) { |
char temp[100]; |
sprintf(temp, "%s, %s ", insn_name(dstats[i].insn1), insn_name(dstats[i].insn2)); |
printf(" %-30s %6dx (%5.1f%%)", temp, dstats[i].cnt_dynamic, (dstats[i].cnt_dynamic * 100.)/SD(all)); |
printf(" depend: %5.1f%%\n", (dstats[i].depend * 100.) / dstats[i].cnt_dynamic); |
PRINTF(" %-30s %6dx (%5.1f%%)", temp, dstats[i].cnt_dynamic, (dstats[i].cnt_dynamic * 100.)/SD(all)); |
PRINTF(" depend: %5.1f%%\n", (dstats[i].depend * 100.) / dstats[i].cnt_dynamic); |
} |
|
printf("%d instructions (dynamic, dependency stats) depend: %d%%\n", all, (dependall * 100) / SD(all)); |
PRINTF("%d instructions (dynamic, dependency stats) depend: %d%%\n", all, (dependall * 100) / SD(all)); |
break; |
|
case 4: |
printf("stats 4: Functional units dependencies\n"); |
PRINTF("stats 4: Functional units dependencies\n"); |
for(i = 0; i < FSTATS_LEN; i++) { |
all += fstats[i].cnt_dynamic; |
dependall += fstats[i].depend; |
255,37 → 255,37
if (fstats[i].cnt_dynamic) { |
char temp[100]; |
sprintf(temp, "%s, %s", func_unit_str[fstats[i].insn1], func_unit_str[fstats[i].insn2]); |
printf(" %-30s %6dx (%5.1f%%)", temp, fstats[i].cnt_dynamic, (fstats[i].cnt_dynamic * 100.)/SD(all)); |
printf(" depend: %5.1f%%\n", (fstats[i].depend * 100.) / fstats[i].cnt_dynamic); |
PRINTF(" %-30s %6dx (%5.1f%%)", temp, fstats[i].cnt_dynamic, (fstats[i].cnt_dynamic * 100.)/SD(all)); |
PRINTF(" depend: %5.1f%%\n", (fstats[i].depend * 100.) / fstats[i].cnt_dynamic); |
} |
printf ("%d instructions (dynamic, functional units stats) depend: %d%%\n\n", all, (dependall * 100) / SD(all)); |
PRINTF ("%d instructions (dynamic, functional units stats) depend: %d%%\n\n", all, (dependall * 100) / SD(all)); |
break; |
|
case 5: |
printf("stats 5: Raw register usage over time\n"); |
PRINTF("stats 5: Raw register usage over time\n"); |
#if RAW_RANGE_STATS |
for(i = 0; (i < MAX_RANGE); i++) |
printf(" Register set and reused in %d. cycle: %d cases\n", i, raw_stats.range[i]); |
PRINTF(" Register set and reused in %d. cycle: %d cases\n", i, raw_stats.range[i]); |
#endif |
break; |
case 6: |
if (config.cpu.sbuf_len) { |
extern int sbuf_total_cyc, sbuf_wait_cyc; |
printf ("stats 6: Store buffer analysis\n"); |
printf ("Using store buffer of length %i.\n", config.cpu.sbuf_len); |
printf ("Number of total memory store cycles: %i/%i\n", sbuf_total_cyc, runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc); |
printf ("Number of cycles waiting for memory stores: %i\n", sbuf_wait_cyc); |
printf ("Number of memory cycles spared: %i\n", sbuf_total_cyc - sbuf_wait_cyc); |
printf ("Store speedup %3.2f%%, total speedup %3.2f%%\n", 100.*(sbuf_total_cyc - sbuf_wait_cyc)/sbuf_total_cyc, |
PRINTF ("stats 6: Store buffer analysis\n"); |
PRINTF ("Using store buffer of length %i.\n", config.cpu.sbuf_len); |
PRINTF ("Number of total memory store cycles: %i/%i\n", sbuf_total_cyc, runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc); |
PRINTF ("Number of cycles waiting for memory stores: %i\n", sbuf_wait_cyc); |
PRINTF ("Number of memory cycles spared: %i\n", sbuf_total_cyc - sbuf_wait_cyc); |
PRINTF ("Store speedup %3.2f%%, total speedup %3.2f%%\n", 100.*(sbuf_total_cyc - sbuf_wait_cyc)/sbuf_total_cyc, |
100.*(sbuf_total_cyc - sbuf_wait_cyc) / (runtime.sim.cycles + sbuf_total_cyc - sbuf_wait_cyc)); |
} else |
printf ("Store buffer analysis disabled. Enable it to see analysis results.\n"); |
PRINTF ("Store buffer analysis disabled. Enable it to see analysis results.\n"); |
break; |
default: |
printf ("Please specify a stats group (1-6).\n"); |
PRINTF ("Please specify a stats group (1-6).\n"); |
break; |
} |
#if 0 |
printf("Byte ADD: %d instructions\n", mstats.byteadd); |
PRINTF("Byte ADD: %d instructions\n", mstats.byteadd); |
#endif |
} |
/trunk/or1ksim/cpu/common/trace.c
28,6 → 28,7
#include "parse.h" |
#include "abstract.h" |
#include "execute.h" |
#include "sim-config.h" |
|
/* Set instruction execution breakpoint. */ |
|
39,13 → 40,13
if (verify_memoryarea(addr)) |
if (has_breakpoint (addr)) { |
remove_breakpoint (addr); |
printf("\nBreakpoint at 0x%.8lx cleared.\n", addr); |
PRINTF("\nBreakpoint at 0x%.8lx cleared.\n", addr); |
} else { |
add_breakpoint (addr); |
printf("\nBreakpoint at 0x%.8lx set.\n", addr); |
PRINTF("\nBreakpoint at 0x%.8lx set.\n", addr); |
} |
else |
printf("ERROR: Can't set this breakpoint out of memory.\n"); |
PRINTF("ERROR: Can't set this breakpoint out of memory.\n"); |
|
return; |
} |
/trunk/or1ksim/cpu/common/Makefile.in
1,6 → 1,6
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
/trunk/or1ksim/cpu/common/abstract.c
270,7 → 270,7
*breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr); /* 28/05/01 CZ */ |
temp = evalsim_mem32(memaddr); |
if (!cur_area) { |
printf("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
temp = 0; |
} |
311,7 → 311,7
else { |
temp = evalsim_mem32(memaddr); |
if (!cur_area) { |
printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
temp = 0; |
} |
339,7 → 339,7
else { |
temp = evalsim_mem32(memaddr); |
if (!cur_area) { |
printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
temp = 0; |
} |
378,7 → 378,7
else { |
temp = evalsim_mem16(memaddr); |
if (!cur_area) { |
printf("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
temp = 0; |
} |
412,7 → 412,7
else { |
temp = evalsim_mem8(memaddr); |
if (!cur_area) { |
printf("EXCEPTION: read out of memory (8-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: read out of memory (8-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
temp = 0; |
} |
447,7 → 447,7
break; |
} |
} else { |
printf("EXCEPTION: write out of memory (32-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: write out of memory (32-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
} |
} |
474,7 → 474,7
break; |
} |
} else { |
printf("EXCEPTION: write out of memory (16-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: write out of memory (16-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
} |
} |
502,7 → 502,7
break; |
} |
} else { |
printf("EXCEPTION: write out of memory (8-bit access to %.8lx)\n", memaddr); |
PRINTF("EXCEPTION: write out of memory (8-bit access to %.8lx)\n", memaddr); |
except_handle(EXCEPT_BUSERR, cur_vadd); |
} |
} |
596,7 → 596,7
int ilen = disasm ? 4 : 16; |
|
for(i = from; i < to; i += ilen) { |
printf("%.8x: ", i); |
PRINTF("%.8x: ", i); |
for (j = 0; j < ilen;) { |
int data = -1; |
if (!disasm) { |
605,9 → 605,9
struct label_entry *entry; |
entry = get_label(i + j); |
if (entry) |
printf("(%s)", entry->name); |
printf("%02x ", data = evalsim_mem8(i+j)); |
} else printf("XX "); |
PRINTF("(%s)", entry->name); |
PRINTF("%02x ", data = evalsim_mem8(i+j)); |
} else PRINTF("XX "); |
j++; |
} else { |
int breakpoint; |
620,20 → 620,20
struct label_entry *entry; |
entry = get_label(i + j); |
if (entry) |
printf("(%s)", entry->name); |
PRINTF("(%s)", entry->name); |
|
printf(": %08x ", (unsigned long)_insn); |
PRINTF(": %08x ", (unsigned long)_insn); |
if (index >= 0) { |
disassemble_insn (_insn); |
printf(" %s", disassembled); |
PRINTF(" %s", disassembled); |
} else |
printf("<invalid>"); |
} else printf("XXXXXXXX"); |
PRINTF("<invalid>"); |
} else PRINTF("XXXXXXXX"); |
j += len; |
} |
} |
if (nl) |
printf ("\n"); |
PRINTF ("\n"); |
} |
} |
|
688,7 → 688,7
cur_area->log = NULL; |
memory_needed += cur_area->size; |
} |
printf ("\n"); |
PRINTF ("\n"); |
} else { |
if (config.sim.verbose) |
fprintf (stderr, "WARNING: Memory not defined, assuming standard configuration.\n"); |
752,24 → 752,24
|
/* Check list of registered devices. */ |
for(ptmp = dev_list; ptmp; ptmp = ptmp->next) { |
printf ("addr & %08x == %08x to %08x, size %08x, gran %iB\n", |
PRINTF ("addr & %08x == %08x to %08x, size %08x, gran %iB\n", |
ptmp->addr_mask, ptmp->addr_compare, ptmp->addr_compare | bit_mask (ptmp->size), |
ptmp->size, ptmp->granularity); |
printf ("\t"); |
PRINTF ("\t"); |
if (ptmp->delayr >= 0) |
printf ("read delay = %i cycles, ", ptmp->delayr); |
PRINTF ("read delay = %i cycles, ", ptmp->delayr); |
else |
printf ("reads not possible, "); |
PRINTF ("reads not possible, "); |
|
if (ptmp->delayw >= 0) |
printf ("write delay = %i cycles", ptmp->delayw); |
PRINTF ("write delay = %i cycles", ptmp->delayw); |
else |
printf ("writes not possible"); |
PRINTF ("writes not possible"); |
|
if (ptmp->log) |
printf (", (logged)\n"); |
PRINTF (", (logged)\n"); |
else |
printf ("\n"); |
PRINTF ("\n"); |
} |
} |
|
/trunk/or1ksim/cpu/common/parse.c
140,8 → 140,8
int i; |
|
/* No translation (i.e. when loading kernel into simulator) |
/* printf("transl_table=%x laddr=%x\n", transl_table, laddr); |
printf("laddr=%x\n", laddr);*/ |
/* PRINTF("transl_table=%x laddr=%x\n", transl_table, laddr); |
PRINTF("laddr=%x\n", laddr);*/ |
if (transl_table == 0) |
return laddr; |
|
149,7 → 149,7
for(i = 0; i < (MEMORY_LEN / PAGE_SIZE) * 16; i += 16) |
if ((laddr & ~(PAGE_SIZE - 1)) == evalsim_mem32(transl_table + i)) { |
setsim_mem32(transl_table + i + 8, -2); /* Page modified */ |
printf("found paddr=%x\n", evalsim_mem32(transl_table + i + 4) | (laddr & (PAGE_SIZE - 1))); |
PRINTF("found paddr=%x\n", evalsim_mem32(transl_table + i + 4) | (laddr & (PAGE_SIZE - 1))); |
return (unsigned long)evalsim_mem32(transl_table + i + 4) | (laddr & (unsigned long)(PAGE_SIZE - 1)); |
} |
|
159,10 → 159,10
setsim_mem32(transl_table + i, laddr & ~(PAGE_SIZE - 1)); /* VPN */ |
setsim_mem32(transl_table + i + 4, (i/16) * PAGE_SIZE); /* PPN */ |
setsim_mem32(transl_table + i + 8, -2); /* Page modified */ |
printf("newly allocated ppn=%x\n", (unsigned long)evalsim_mem32(transl_table + i + 4)); |
printf("newly allocated .ppn=%x\n", (unsigned long)transl_table + i + 4); |
printf("newly allocated ofs=%x\n", (unsigned long)(laddr & (PAGE_SIZE - 1))); |
printf("newly allocated paddr=%x\n", (unsigned long)evalsim_mem32(transl_table + i + 4) | (laddr & (PAGE_SIZE - 1))); |
PRINTF("newly allocated ppn=%x\n", (unsigned long)evalsim_mem32(transl_table + i + 4)); |
PRINTF("newly allocated .ppn=%x\n", (unsigned long)transl_table + i + 4); |
PRINTF("newly allocated ofs=%x\n", (unsigned long)(laddr & (PAGE_SIZE - 1))); |
PRINTF("newly allocated paddr=%x\n", (unsigned long)evalsim_mem32(transl_table + i + 4) | (laddr & (PAGE_SIZE - 1))); |
return (unsigned long)evalsim_mem32(transl_table + i + 4) | (laddr & (unsigned long)(PAGE_SIZE - 1)); |
} |
/* If we come this far then all phy memory is used and we can't find our page |
169,7 → 169,7
nor allocate new page. */ |
transl_error = 1; |
|
printf("can't translate\n", laddr); |
PRINTF("can't translate\n", laddr); |
exit(1); |
return -1; |
} |
227,7 → 227,7
movhi = data << 16; |
} else { |
data |= movhi; |
//printf ("%08x %s\n", data, name); |
//PRINTF ("%08x %s\n", data, name); |
if (!(or32_opcodes[insn_index].flags & OR32_IF_DELAY)) { |
bcnt[bits(data)][0]++; bsum[0]++; |
} else { |
314,38 → 314,38
perror("readfile_coff"); |
exit(1); |
} |
printf("Section: %s,", coffscnhdr.s_name); |
printf(" paddr: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_paddr)); |
printf(" vaddr: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_vaddr)); |
printf(" size: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_size)); |
printf(" scnptr: 0x%.8x\n", COFF_LONG_H(coffscnhdr.s_scnptr)); |
PRINTF("Section: %s,", coffscnhdr.s_name); |
PRINTF(" paddr: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_paddr)); |
PRINTF(" vaddr: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_vaddr)); |
PRINTF(" size: 0x%.8x,", COFF_LONG_H(coffscnhdr.s_size)); |
PRINTF(" scnptr: 0x%.8x\n", COFF_LONG_H(coffscnhdr.s_scnptr)); |
|
sectsize = COFF_LONG_H(coffscnhdr.s_size); |
#if 0 |
/* A couple of sanity checks. */ |
if (translate(COFF_LONG_H(coffscnhdr.s_vaddr),&breakpoint) < MEMORY_START) { |
printf("Section %s starts out of ", coffscnhdr.s_name); |
printf("memory (at %x)\n", COFF_LONG_H(coffscnhdr.s_vaddr)); |
PRINTF("Section %s starts out of ", coffscnhdr.s_name); |
PRINTF("memory (at %x)\n", COFF_LONG_H(coffscnhdr.s_vaddr)); |
exit(1); |
} |
if (translate(COFF_LONG_H(coffscnhdr.s_vaddr) + sectsize,&breakpoint) > |
MEMORY_START + MEMORY_LEN) { |
printf("Section %s ends out of ", coffscnhdr.s_name); |
printf("memory.\n"); |
PRINTF("Section %s ends out of ", coffscnhdr.s_name); |
PRINTF("memory.\n"); |
exit(1); |
} |
#endif |
#if 0 |
if (++firstthree == 1 && strcmp(coffscnhdr.s_name, ".text") != 0) { |
printf("First section should be .text (%s instead)\n", coffscnhdr.s_name); |
PRINTF("First section should be .text (%s instead)\n", coffscnhdr.s_name); |
exit(1); |
} |
if (firstthree == 2 && strcmp(coffscnhdr.s_name, ".data") != 0) { |
printf("Second section should be .data (%s instead)\n", coffscnhdr.s_name); |
PRINTF("Second section should be .data (%s instead)\n", coffscnhdr.s_name); |
exit(1); |
} |
if (firstthree == 3 && strcmp(coffscnhdr.s_name, ".bss") != 0) { |
printf("Third section should be .bss (%s instead)\n", coffscnhdr.s_name); |
PRINTF("Third section should be .bss (%s instead)\n", coffscnhdr.s_name); |
exit(1); |
} |
#else |
375,17 → 375,17
} |
} |
if (firstthree < 3) { |
printf("One or more missing sections. At least"); |
printf(" three sections expected (.text, .data, .bss).\n"); |
PRINTF("One or more missing sections. At least"); |
PRINTF(" three sections expected (.text, .data, .bss).\n"); |
exit(1); |
} |
if (firstthree > 3) { |
printf("Warning: one or more extra sections. These"); |
printf(" sections were handled as .data sections.\n"); |
PRINTF("Warning: one or more extra sections. These"); |
PRINTF(" sections were handled as .data sections.\n"); |
} |
|
fclose(inputfs); |
printf("Finished loading COFF.\n"); |
PRINTF("Finished loading COFF.\n"); |
return; |
} |
|
459,7 → 459,7
} |
|
fclose(inputfs); |
printf("Finished loading symbols.\n"); |
PRINTF("Finished loading symbols.\n"); |
return; |
} |
|
597,13 → 597,13
|
|
if (ELF_LONG_H(elf_spnt->sh_name) && s_str) |
printf("Section: %s,", &s_str[ELF_LONG_H(elf_spnt->sh_name)]); |
PRINTF("Section: %s,", &s_str[ELF_LONG_H(elf_spnt->sh_name)]); |
else |
printf("Section: noname,"); |
printf(" vaddr: 0x%.8x,", ELF_LONG_H(elf_spnt->sh_addr)); |
printf(" paddr: 0x%.8x,", padd); |
printf(" offset: 0x%.8x,", ELF_LONG_H(elf_spnt->sh_offset)); |
printf(" size: 0x%.8x\n", ELF_LONG_H(elf_spnt->sh_size)); |
PRINTF("Section: noname,"); |
PRINTF(" vaddr: 0x%.8x,", ELF_LONG_H(elf_spnt->sh_addr)); |
PRINTF(" paddr: 0x%.8x,", padd); |
PRINTF(" offset: 0x%.8x,", ELF_LONG_H(elf_spnt->sh_offset)); |
PRINTF(" size: 0x%.8x\n", ELF_LONG_H(elf_spnt->sh_size)); |
|
freemem = padd; |
sectsize = ELF_LONG_H(elf_spnt->sh_size); |
659,17 → 659,17
if (fread(&coffhdr, sizeof(coffhdr), 1, inputfs) == 1) { |
if (COFF_SHORT_H(coffhdr.f_magic) == 0x17a) { |
unsigned long opthdr_size; |
printf("COFF magic: 0x%.4x\n", COFF_SHORT_H(coffhdr.f_magic)); |
printf("COFF flags: 0x%.4x\n", COFF_SHORT_H(coffhdr.f_flags)); |
printf("COFF symptr: 0x%.8x\n", COFF_LONG_H(coffhdr.f_symptr)); |
PRINTF("COFF magic: 0x%.4x\n", COFF_SHORT_H(coffhdr.f_magic)); |
PRINTF("COFF flags: 0x%.4x\n", COFF_SHORT_H(coffhdr.f_flags)); |
PRINTF("COFF symptr: 0x%.8x\n", COFF_LONG_H(coffhdr.f_symptr)); |
if ((COFF_SHORT_H(coffhdr.f_flags) & COFF_F_EXEC) != COFF_F_EXEC) { |
printf("This COFF is not an executable.\n"); |
PRINTF("This COFF is not an executable.\n"); |
exit(1); |
} |
opthdr_size = COFF_SHORT_H(coffhdr.f_opthdr); |
if (opthdr_size != sizeof(COFF_AOUTHDR)) { |
printf("COFF optional header is missing or not recognized.\n"); |
printf("COFF f_opthdr: 0x%.2x\n", opthdr_size); |
PRINTF("COFF optional header is missing or not recognized.\n"); |
PRINTF("COFF f_opthdr: 0x%.2x\n", opthdr_size); |
exit(1); |
} |
fclose(inputfs); |
678,18 → 678,18
return; |
} |
else { |
printf("Not COFF file format\n"); |
PRINTF("Not COFF file format\n"); |
fseek(inputfs, 0, SEEK_SET); |
} |
} |
if (fread(&elfhdr, sizeof(elfhdr), 1, inputfs) == 1) { |
if (elfhdr.e_ident[0] == 0x7f && elfhdr.e_ident[1] == 0x45 && elfhdr.e_ident[2] == 0x4c && elfhdr.e_ident[3] == 0x46) { |
printf("ELF type: 0x%.4x\n", ELF_SHORT_H(elfhdr.e_type)); |
printf("ELF machine: 0x%.4x\n", ELF_SHORT_H(elfhdr.e_machine)); |
printf("ELF version: 0x%.8x\n", ELF_LONG_H(elfhdr.e_version)); |
printf("ELF sec = %d\n", ELF_SHORT_H(elfhdr.e_shnum)); |
PRINTF("ELF type: 0x%.4x\n", ELF_SHORT_H(elfhdr.e_type)); |
PRINTF("ELF machine: 0x%.4x\n", ELF_SHORT_H(elfhdr.e_machine)); |
PRINTF("ELF version: 0x%.8x\n", ELF_LONG_H(elfhdr.e_version)); |
PRINTF("ELF sec = %d\n", ELF_SHORT_H(elfhdr.e_shnum)); |
if (ELF_SHORT_H(elfhdr.e_type) != ET_EXEC ) { |
printf("This ELF is not an executable.\n"); |
PRINTF("This ELF is not an executable.\n"); |
exit(1); |
} |
fclose(inputfs); |
697,7 → 697,7
return; |
} |
else { |
printf("Not ELF file format.\n"); |
PRINTF("Not ELF file format.\n"); |
fseek(inputfs, 0, SEEK_SET); |
} |
} |
717,16 → 717,16
transl_error = 0; |
transl_table = virtphy_transl; |
freemem = startaddr; |
printf("loadcode: filename %s startaddr=%x virtphy_transl=%x\n", filename, startaddr, virtphy_transl); |
PRINTF("loadcode: filename %s startaddr=%x virtphy_transl=%x\n", filename, startaddr, virtphy_transl); |
identifyfile(filename); |
|
#if IMM_STATS |
{ |
int i = 0, a = 0, b = 0, c = 0; |
printf ("index:arith/branch/jump\n"); |
for (i = 0; i < 33; i++) printf ("%2i:\t%3.0f%% / %3.0f%%/ %3.0f%%\t%5i / %5i / %5i\n", i, 100.* (a += bcnt[i][0])/bsum[0], |
PRINTF ("index:arith/branch/jump\n"); |
for (i = 0; i < 33; i++) PRINTF ("%2i:\t%3.0f%% / %3.0f%%/ %3.0f%%\t%5i / %5i / %5i\n", i, 100.* (a += bcnt[i][0])/bsum[0], |
100.* (b += bcnt[i][1])/bsum[1], 100.* (c += bcnt[i][2])/bsum[2], bcnt[i][0], bcnt[i][1], bcnt[i][2]); |
printf ("\nsum %i %i %i\n", bsum[0], bsum[1], bsum[2]); |
PRINTF ("\nsum %i %i %i\n", bsum[0], bsum[1], bsum[2]); |
} |
#endif |
|
/trunk/or1ksim/cpu/or1k/Makefile.in
1,6 → 1,6
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
/trunk/or1ksim/cpu/or1k/sprs.c
70,7 → 70,7
pc = value; |
|
if(!value && config.sim.verbose) |
printf("WARNING: PC just set to 0!\n"); |
PRINTF("WARNING: PC just set to 0!\n"); |
|
/* Clear any pending delay slot jumps also */ |
delay_insn = 0; |
79,25 → 79,25
break; |
case 0xFFFD: |
fo = fopen ("audiosim.pcm", "wb+"); |
if (!fo) printf("Cannot open audiosim.pcm\n"); |
printf("Audio opened.\n"); |
if (!fo) PRINTF("Cannot open audiosim.pcm\n"); |
PRINTF("Audio opened.\n"); |
break; |
case 0xFFFE: |
if (!fo) printf("audiosim.pcm not opened\n"); |
if (!fo) PRINTF("audiosim.pcm not opened\n"); |
fputc (value & 0xFF, fo); |
if ((audio_cnt % 1024) == 0) |
printf("%i\n", audio_cnt); |
PRINTF("%i\n", audio_cnt); |
audio_cnt++; |
break; |
case 0xFFFF: |
fclose(fo); |
printf("Audio closed.\n"); |
PRINTF("Audio closed.\n"); |
runtime.sim.cont_run = 0; |
break; |
case SPR_PMR: |
/* PMR[SDF] and PMR[DCGE] are ignored completely. */ |
if (value & SPR_PMR_SUME) { |
printf ("SUSPEND: PMR[SUME] bit was set.\n"); |
PRINTF ("SUSPEND: PMR[SUME] bit was set.\n"); |
runtime.sim.cont_run = 0; |
} |
break; |
138,13 → 138,13
/* Show status of important SPRs. */ |
void sprs_status() |
{ |
printf("VR : 0x%.8x UPR : 0x%.8x\n", mfspr(SPR_VR), mfspr(SPR_UPR)); |
printf("SR : 0x%.8x\n", mfspr(SPR_SR)); |
printf("MACLO: 0x%.8x MACHI: 0x%.8x\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI)); |
printf("EPCR0: 0x%.8x EPCR1: 0x%.8x\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1)); |
printf("EEAR0: 0x%.8x EEAR1: 0x%.8x\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1)); |
printf("ESR0 : 0x%.8x ESR1 : 0x%.8x\n", mfspr(SPR_ESR_BASE), mfspr(SPR_ESR_BASE+1)); |
printf("TTMR : 0x%.8x TTCR : 0x%.8x\n", mfspr(SPR_TTMR), mfspr(SPR_TTCR)); |
printf("PICMR: 0x%.8x PICSR: 0x%.8x\n", mfspr(SPR_PICMR), mfspr(SPR_PICSR)); |
printf("PPC: 0x%.8x NPC : 0x%.8x\n", mfspr(SPR_PPC), mfspr(SPR_NPC)); |
PRINTF("VR : 0x%.8x UPR : 0x%.8x\n", mfspr(SPR_VR), mfspr(SPR_UPR)); |
PRINTF("SR : 0x%.8x\n", mfspr(SPR_SR)); |
PRINTF("MACLO: 0x%.8x MACHI: 0x%.8x\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI)); |
PRINTF("EPCR0: 0x%.8x EPCR1: 0x%.8x\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1)); |
PRINTF("EEAR0: 0x%.8x EEAR1: 0x%.8x\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1)); |
PRINTF("ESR0 : 0x%.8x ESR1 : 0x%.8x\n", mfspr(SPR_ESR_BASE), mfspr(SPR_ESR_BASE+1)); |
PRINTF("TTMR : 0x%.8x TTCR : 0x%.8x\n", mfspr(SPR_TTMR), mfspr(SPR_TTCR)); |
PRINTF("PICMR: 0x%.8x PICSR: 0x%.8x\n", mfspr(SPR_PICMR), mfspr(SPR_PICSR)); |
PRINTF("PPC: 0x%.8x NPC : 0x%.8x\n", mfspr(SPR_PPC), mfspr(SPR_NPC)); |
} |
/trunk/or1ksim/cpu/or1k/except.c
59,7 → 59,7
pending.saved = pc - 4; |
else |
pending.saved = pc; |
if (config.sim.verbose) printf("Exception 0x%x (%s) at 0x%x, EA: 0x%x, ppc: 0x%x, npc: 0x%x\n", |
if (config.sim.verbose) PRINTF("Exception 0x%x (%s) at 0x%x, EA: 0x%x, ppc: 0x%x, npc: 0x%x\n", |
except, EXCEPT_NAME(except), iqueue[0].insn_addr, ea, pc, pcnext); |
} |
} |
73,7 → 73,7
#else |
|
if (delay_insn) { |
if (config.sim.verbose) printf("INFO: Exception during execution of delay slot insn.\n"); |
if (config.sim.verbose) PRINTF("INFO: Exception during execution of delay slot insn.\n"); |
pc -= 4; |
} |
|
/trunk/or1ksim/cpu/or1k/sprs.h
59,7 → 59,7
return sprs[regno]; |
} |
if (config.sim.verbose) |
printf ("WARNING: read out of SPR range %08X\n", regno); |
PRINTF ("WARNING: read out of SPR range %08X\n", regno); |
return 0; |
} |
|
79,7 → 79,7
v++; |
} |
|
/* printf("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */ |
/* PRINTF("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */ |
mtspr(regno, (regvalue & ~mask) | shifted); |
} |
|
/trunk/or1ksim/config.guess
355,13 → 355,13
int main (argc, argv) int argc; char **argv; { |
#if defined (host_mips) && defined (MIPSEB) |
#if defined (SYSTYPE_SYSV) |
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); |
PRINTF ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); |
#endif |
#if defined (SYSTYPE_SVR4) |
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); |
PRINTF ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); |
#endif |
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) |
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); |
PRINTF ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); |
#endif |
#endif |
exit (-1); |
694,10 → 694,10
char *argv[]; |
{ |
#ifdef __MIPSEB__ |
printf ("%s-unknown-linux-gnu\n", argv[1]); |
PRINTF ("%s-unknown-linux-gnu\n", argv[1]); |
#endif |
#ifdef __MIPSEL__ |
printf ("%sel-unknown-linux-gnu\n", argv[1]); |
PRINTF ("%sel-unknown-linux-gnu\n", argv[1]); |
#endif |
return 0; |
} |
731,15 → 731,15
#ifdef __ELF__ |
# ifdef __GLIBC__ |
# if __GLIBC__ >= 2 |
printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); |
PRINTF ("%s-${VENDOR}-linux-gnu\n", argv[1]); |
# else |
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
PRINTF ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
# endif |
# else |
printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
PRINTF ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); |
# endif |
#else |
printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); |
PRINTF ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); |
#endif |
return 0; |
} |
899,10 → 899,10
#if defined (MIPSEB) |
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, |
I don't know.... */ |
printf ("mips-sony-bsd\n"); exit (0); |
PRINTF ("mips-sony-bsd\n"); exit (0); |
#else |
#include <sys/param.h> |
printf ("m68k-sony-newsos%s\n", |
PRINTF ("m68k-sony-newsos%s\n", |
#ifdef NEWSOS4 |
"4" |
#else |
913,15 → 913,15
#endif |
|
#if defined (__arm) && defined (__acorn) && defined (__unix) |
printf ("arm-acorn-riscix\n"); exit (0); |
PRINTF ("arm-acorn-riscix\n"); exit (0); |
#endif |
|
#if defined (hp9000) && !defined (hpux) |
printf ("m68k-hp-bsd\n"); exit (0); |
PRINTF ("m68k-hp-bsd\n"); exit (0); |
#endif |
|
#if defined (hp300) && !defined (hpux) |
printf ("m68k-hp-bsd\n"); exit (0); |
PRINTF ("m68k-hp-bsd\n"); exit (0); |
#endif |
|
#if defined (NeXT) |
930,32 → 930,32
#endif |
int version; |
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; |
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); |
PRINTF ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); |
exit (0); |
#endif |
|
#if defined (MULTIMAX) || defined (n16) |
#if defined (UMAXV) |
printf ("ns32k-encore-sysv\n"); exit (0); |
PRINTF ("ns32k-encore-sysv\n"); exit (0); |
#else |
#if defined (CMU) |
printf ("ns32k-encore-mach\n"); exit (0); |
PRINTF ("ns32k-encore-mach\n"); exit (0); |
#else |
printf ("ns32k-encore-bsd\n"); exit (0); |
PRINTF ("ns32k-encore-bsd\n"); exit (0); |
#endif |
#endif |
#endif |
|
#if defined (__386BSD__) |
printf ("i386-pc-bsd\n"); exit (0); |
PRINTF ("i386-pc-bsd\n"); exit (0); |
#endif |
|
#if defined (sequent) |
#if defined (i386) |
printf ("i386-sequent-dynix\n"); exit (0); |
PRINTF ("i386-sequent-dynix\n"); exit (0); |
#endif |
#if defined (ns32000) |
printf ("ns32k-sequent-dynix\n"); exit (0); |
PRINTF ("ns32k-sequent-dynix\n"); exit (0); |
#endif |
#endif |
|
965,130 → 965,130
uname(&un); |
|
if (strncmp(un.version, "V2", 2) == 0) { |
printf ("i386-sequent-ptx2\n"); exit (0); |
PRINTF ("i386-sequent-ptx2\n"); exit (0); |
} |
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ |
printf ("i386-sequent-ptx1\n"); exit (0); |
PRINTF ("i386-sequent-ptx1\n"); exit (0); |
} |
printf ("i386-sequent-ptx\n"); exit (0); |
PRINTF ("i386-sequent-ptx\n"); exit (0); |
|
#endif |
|
#if defined (vax) |
#if !defined (ultrix) |
printf ("vax-dec-bsd\n"); exit (0); |
PRINTF ("vax-dec-bsd\n"); exit (0); |
#else |
printf ("vax-dec-ultrix\n"); exit (0); |
PRINTF ("vax-dec-ultrix\n"); exit (0); |
#endif |
#endif |
|
#if defined (alliant) && defined (i860) |
printf ("i860-alliant-bsd\n"); exit (0); |
PRINTF ("i860-alliant-bsd\n"); exit (0); |
#endif |
|
/* Begin cases added for Bash */ |
#if defined (tahoe) |
printf ("tahoe-cci-bsd\n"); exit (0); |
PRINTF ("tahoe-cci-bsd\n"); exit (0); |
#endif |
|
#if defined (nec_ews) |
# if defined (SYSTYPE_SYSV) |
printf ("ews4800-nec-sysv4\n"); exit 0; |
PRINTF ("ews4800-nec-sysv4\n"); exit 0; |
# else |
printf ("ews4800-nec-bsd\n"); exit (0); |
PRINTF ("ews4800-nec-bsd\n"); exit (0); |
# endif |
#endif |
|
#if defined (sony) |
# if defined (SYSTYPE_SYSV) |
printf ("mips-sony-sysv4\n"); exit 0; |
PRINTF ("mips-sony-sysv4\n"); exit 0; |
# else |
printf ("mips-sony-bsd\n"); exit (0); |
PRINTF ("mips-sony-bsd\n"); exit (0); |
# endif |
#endif |
|
#if defined (ardent) |
printf ("titan-ardent-bsd\n"); exit (0); |
PRINTF ("titan-ardent-bsd\n"); exit (0); |
#endif |
|
#if defined (stardent) |
printf ("stardent-stardent-sysv\n"); exit (0); |
PRINTF ("stardent-stardent-sysv\n"); exit (0); |
#endif |
|
#if defined (ibm032) |
printf ("ibmrt-ibm-bsd4.3\n"); exit (0); |
PRINTF ("ibmrt-ibm-bsd4.3\n"); exit (0); |
#endif |
|
#if defined (sequent) && defined (i386) |
printf ("i386-sequent-bsd\n"); exit (0); |
PRINTF ("i386-sequent-bsd\n"); exit (0); |
#endif |
|
#if defined (qnx) && defined (i386) |
printf ("i386-pc-qnx\n"); exit (0); |
PRINTF ("i386-pc-qnx\n"); exit (0); |
#endif |
|
#if defined (gould) |
printf ("gould-gould-bsd\n"); exit (0); |
PRINTF ("gould-gould-bsd\n"); exit (0); |
#endif |
|
#if defined (unixpc) |
printf ("unixpc-att-sysv\n"); exit (0); |
PRINTF ("unixpc-att-sysv\n"); exit (0); |
#endif |
|
#if defined (att386) |
printf ("i386-att-sysv3\n"); exit (0); |
PRINTF ("i386-att-sysv3\n"); exit (0); |
#endif |
|
#if defined (__m88k) && defined (__UMAXV__) |
printf ("m88k-encore-sysv3\n"); exit (0); |
PRINTF ("m88k-encore-sysv3\n"); exit (0); |
#endif |
|
#if defined (drs6000) |
printf ("drs6000-icl-sysv4.2\n"); exit (0); |
PRINTF ("drs6000-icl-sysv4.2\n"); exit (0); |
#endif |
|
#if defined (clipper) |
printf ("clipper-orion-bsd\n"); exit (0); |
PRINTF ("clipper-orion-bsd\n"); exit (0); |
#endif |
|
#if defined (is68k) |
printf ("m68k-isi-bsd\n"); exit (0); |
PRINTF ("m68k-isi-bsd\n"); exit (0); |
#endif |
|
#if defined (luna88k) |
printf ("luna88k-omron-bsd\n"); exit (0); |
PRINTF ("luna88k-omron-bsd\n"); exit (0); |
#endif |
|
#if defined (butterfly) && defined (BFLY1) |
printf ("butterfly-bbn-mach\n"); exit (0); |
PRINTF ("butterfly-bbn-mach\n"); exit (0); |
#endif |
|
#if defined (tower32) |
printf ("tower32-ncr-sysv4\n"); exit (0); |
PRINTF ("tower32-ncr-sysv4\n"); exit (0); |
#endif |
|
#if defined (MagicStation) |
printf ("magicstation-unknown-bsd\n"); exit (0); |
PRINTF ("magicstation-unknown-bsd\n"); exit (0); |
#endif |
|
#if defined (scs) |
printf ("symmetric-scs-bsd4.2\n"); exit (0); |
PRINTF ("symmetric-scs-bsd4.2\n"); exit (0); |
#endif |
|
#if defined (tandem) |
printf ("tandem-tandem-sysv\n"); exit (0); |
PRINTF ("tandem-tandem-sysv\n"); exit (0); |
#endif |
|
#if defined (cadmus) |
printf ("cadmus-pcs-sysv\n"); exit (0); |
PRINTF ("cadmus-pcs-sysv\n"); exit (0); |
#endif |
|
#if defined (masscomp) |
printf ("masscomp-masscomp-sysv3\n"); exit (0); |
PRINTF ("masscomp-masscomp-sysv3\n"); exit (0); |
#endif |
|
#if defined (hbullx20) |
printf ("hbullx20-bull-sysv3\n"); exit (0); |
PRINTF ("hbullx20-bull-sysv3\n"); exit (0); |
#endif |
|
/* End cases added for Bash */ |
/trunk/or1ksim/tick/tick.c
46,7 → 46,7
void tick_reset() |
{ |
if (config.sim.verbose) |
printf("Resetting Tick Timer.\n"); |
PRINTF("Resetting Tick Timer.\n"); |
mtspr(SPR_TTCR, 0); |
mtspr(SPR_TTMR, 0); |
} |
/trunk/or1ksim/profiler.c
58,12 → 58,12
/* Print out command line help */ |
void prof_help () |
{ |
printf ("profiler [-c] [-q] -g [profile_file_name]\n"); |
printf ("\t-c\t--cumulative\t\tcumulative sum of cycles in functions\n"); |
printf ("\t-q\t--quiet\t\t\tsuppress messages\n"); |
printf ("\t-g\t--generate [profile_file_name]\n"); |
printf ("\t\t\t\t\toutput profiling results to\n"); |
printf ("\t\t\t\t\tstdout/profile_file_name\n"); |
PRINTF ("profiler [-c] [-q] -g [profile_file_name]\n"); |
PRINTF ("\t-c\t--cumulative\t\tcumulative sum of cycles in functions\n"); |
PRINTF ("\t-q\t--quiet\t\t\tsuppress messages\n"); |
PRINTF ("\t-g\t--generate [profile_file_name]\n"); |
PRINTF ("\t\t\t\t\toutput profiling results to\n"); |
PRINTF ("\t\t\t\t\tstdout/profile_file_name\n"); |
} |
|
/* Acquire data from profiler file */ |
188,10 → 188,10
{ |
int i, j; |
if (cumulative) |
printf ("CUMULATIVE TIMES\n"); |
printf ("---------------------------------------------------------------------------\n"); |
printf ("|function name |addr |# calls |avg cycles |total cyles |\n"); |
printf ("|-------------------------+--------+--------+------------+----------------|\n"); |
PRINTF ("CUMULATIVE TIMES\n"); |
PRINTF ("---------------------------------------------------------------------------\n"); |
PRINTF ("|function name |addr |# calls |avg cycles |total cyles |\n"); |
PRINTF ("|-------------------------+--------+--------+------------+----------------|\n"); |
for (j = 0; j < prof_nfuncs; j++) { |
int bestcyc = 0, besti = 0; |
for (i = 0; i < prof_nfuncs; i++) |
200,13 → 200,13
besti = i; |
} |
i = besti; |
printf ("| %-24s|%08X|%8i|%12.1f|%11i,%3.0f%%|\n", |
PRINTF ("| %-24s|%08X|%8i|%12.1f|%11i,%3.0f%%|\n", |
prof_func[i].name, prof_func[i].addr, prof_func[i].calls, ((double)prof_func[i].cum_cycles / prof_func[i].calls), prof_func[i].cum_cycles, (100. * prof_func[i].cum_cycles / prof_cycles)); |
prof_func[i].cum_cycles = -1; |
} |
printf ("---------------------------------------------------------------------------\n"); |
printf ("Total %i functions, %i cycles.\n", prof_nfuncs, prof_cycles); |
printf ("Total function calls %i/%i (max depth %i).\n", nfunccalls, ntotcalls, maxstack); |
PRINTF ("---------------------------------------------------------------------------\n"); |
PRINTF ("Total %i functions, %i cycles.\n", prof_nfuncs, prof_cycles); |
PRINTF ("Total function calls %i/%i (max depth %i).\n", nfunccalls, ntotcalls, maxstack); |
} |
|
/* Set options */ |
/trunk/or1ksim/cache/dcache_model.c
49,12 → 49,12
void dc_info() |
{ |
if (!testsprbits(SPR_UPR, SPR_UPR_DCP)) { |
printf("DCache not implemented. Set UPR[DCP].\n"); |
PRINTF("DCache not implemented. Set UPR[DCP].\n"); |
return; |
} |
|
printf("Data cache %dKB: ", config.dc.nsets * config.dc.blocksize * config.dc.nways / 1024); |
printf("%d ways, %d sets, block size %d bytes\n", config.dc.nways, config.dc.nsets, config.dc.blocksize); |
PRINTF("Data cache %dKB: ", config.dc.nsets * config.dc.blocksize * config.dc.nways / 1024); |
PRINTF("%d ways, %d sets, block size %d bytes\n", config.dc.nways, config.dc.nsets, config.dc.blocksize); |
} |
|
/* First check if data is already in the cache and if it is: |
/trunk/or1ksim/cache/icache_model.c
49,12 → 49,12
void ic_info() |
{ |
if (!testsprbits(SPR_UPR, SPR_UPR_ICP)) { |
printf("ICache not implemented. Set UPR[ICP].\n"); |
PRINTF("ICache not implemented. Set UPR[ICP].\n"); |
return; |
} |
|
printf("Instruction cache %dKB: ", config.ic.nsets * config.ic.blocksize * config.ic.nways / 1024); |
printf("%d ways, %d sets, block size %d bytes\n", config.ic.nways, config.ic.nsets, config.ic.blocksize); |
PRINTF("Instruction cache %dKB: ", config.ic.nsets * config.ic.blocksize * config.ic.nways / 1024); |
PRINTF("%d ways, %d sets, block size %d bytes\n", config.ic.nways, config.ic.nsets, config.ic.blocksize); |
} |
|
/* First check if instruction is already in the cache and if it is: |
/trunk/or1ksim/cuc/cuc.h
95,7 → 95,7
|
#define log(x...) fprintf (flog, x) |
|
#define cucdebug(x,s...) {if ((x) <= cuc_debug) printf (s);} |
#define cucdebug(x,s...) {if ((x) <= cuc_debug) PRINTF (s);} |
|
#define CUC_WIDTH_ITERATIONS 256 |
|
/trunk/or1ksim/cuc/load.c
68,9 → 68,9
void print_cuc_insns (char *s, int verbose) |
{ |
int i, j; |
printf ("****************** %s ******************\n", s); |
PRINTF ("****************** %s ******************\n", s); |
print_insns (insn, num_insn,verbose); |
printf ("\n\n"); |
PRINTF ("\n\n"); |
} |
|
void xchg_insn (int i, int j) |
374,7 → 374,7
/* build params */ |
name = build_insn (data, &insn[i]); |
if (func_return) func_return++; |
//printf ("%s\n", name); |
//PRINTF ("%s\n", name); |
|
if (or32_opcodes[insn[i].index].flags & OR32_IF_DELAY) { |
int f; |
/trunk/or1ksim/cuc/bb.c
30,10 → 30,10
/* prints out bb string */ |
void print_bb_num (int num) |
{ |
if (num < 0) printf ("*"); |
else if (num == BBID_END) printf ("END"); |
else if (num == BBID_START) printf ("START"); |
else printf ("%2x", num); |
if (num < 0) PRINTF ("*"); |
else if (num == BBID_END) PRINTF ("END"); |
else if (num == BBID_START) PRINTF ("START"); |
else PRINTF ("%2x", num); |
} |
|
/* Print out basic blocks */ |
40,25 → 40,25
void print_cuc_bb (cuc_func *f, char *s) |
{ |
int i; |
printf ("------- %s -------\n", s); |
PRINTF ("------- %s -------\n", s); |
for (i = 0; i < f->num_bb; i++) { |
if (f->bb[i].insn) printf ("\n---- BB%-2x * %x ---- ", i, f->bb[i].cnt); |
else printf ("BB%-2x: %4x-%-4x", i, f->bb[i].first, f->bb[i].last); |
printf (" type %02x tmp %i ", f->bb[i].type, f->bb[i].tmp); |
printf ("next "); print_bb_num (f->bb[i].next[0]); |
printf (" "); print_bb_num (f->bb[i].next[1]); |
printf (" prev "); print_bb_num (f->bb[i].prev[0]); |
printf (" "); print_bb_num (f->bb[i].prev[1]); |
printf ("\n"); |
if (f->bb[i].insn) PRINTF ("\n---- BB%-2x * %x ---- ", i, f->bb[i].cnt); |
else PRINTF ("BB%-2x: %4x-%-4x", i, f->bb[i].first, f->bb[i].last); |
PRINTF (" type %02x tmp %i ", f->bb[i].type, f->bb[i].tmp); |
PRINTF ("next "); print_bb_num (f->bb[i].next[0]); |
PRINTF (" "); print_bb_num (f->bb[i].next[1]); |
PRINTF (" prev "); print_bb_num (f->bb[i].prev[0]); |
PRINTF (" "); print_bb_num (f->bb[i].prev[1]); |
PRINTF ("\n"); |
|
if (f->bb[i].insn) print_insns (f->bb[i].insn, f->bb[i].ninsn, 0); |
} |
if (f->nmsched) { |
printf ("\nmsched: "); |
PRINTF ("\nmsched: "); |
for (i = 0; i < f->nmsched; i++) |
printf ("%x ", f->msched[i]); |
printf ("\n\n\n"); |
} else printf ("\n"); |
PRINTF ("%x ", f->msched[i]); |
PRINTF ("\n\n\n"); |
} else PRINTF ("\n"); |
fflush (stdout); |
} |
|
610,7 → 610,7
} |
|
f->bb[succ].type = BB_DEAD; |
//printf (" %x %x %x %x %x\n", f->bb[pred].next[0], f->bb[pred].next[1], f->bb[succ].next[0], f->bb[succ].next[1], insn[ninsn - 1].type); |
//PRINTF (" %x %x %x %x %x\n", f->bb[pred].next[0], f->bb[pred].next[1], f->bb[succ].next[0], f->bb[succ].next[1], insn[ninsn - 1].type); |
/* remove branch instruction, if there is only one successor */ |
if (f->bb[pred].next[1] < 0 && ninsn > 0 && insn[ninsn - 1].type & IT_BRANCH) { |
assert (f->bb[pred].next[0] != pred); /* end BB, loop should not be possible */ |
636,7 → 636,7
if (REF_BB (f->bb[i].insn[j].op[k]) == succ) { |
int t = f->bb[i].insn[j].op[k]; |
int ndest = REF (pred, REF_I (t) + n1); |
//printf ("%x: %x %x\n", REF(i, j), t, ndest); |
//PRINTF ("%x: %x %x\n", REF(i, j), t, ndest); |
|
/* We've found a reference to succ. block, being removed, relocate */ |
f->bb[i].insn[j].op[k] = ndest; |
823,17 → 823,17
int i, j; |
cuc_insn *insn = f->bb[cur].insn; |
|
//printf ("\n %i", cur); |
//PRINTF ("\n %i", cur); |
/* Spread only, do not loop */ |
if (f->bb[cur].tmp) return; |
f->bb[cur].tmp = 1; |
//printf ("! "); |
//PRINTF ("! "); |
|
for (i = 0; i < f->bb[cur].ninsn; i++) { |
/* Check for destination operand(s) */ |
for (j = 0; j < MAX_OPERANDS; j++) if (insn[i].opt[j] & OPT_DEST) |
if ((insn[i].opt[j] & ~OPT_DEST) == OPT_REGISTER && (signed)insn[i].op[j] >= 0) { |
//printf ("%i:%i,%x ", insn[i].op[j], i, REF (cur, i)); |
//PRINTF ("%i:%i,%x ", insn[i].op[j], i, REF (cur, i)); |
assert (insn[i].op[j] > 0 && insn[i].op[j] < MAX_REGS); /* r0 should never be dest */ |
f->bb[cur].last_used_reg[insn[i].op[j]] = REF (cur, i); |
} |
1099,7 → 1099,7
for (b = 0; b < f->num_bb; b++) { |
bb_start[b] = f->start_addr + f->bb[b].first * 4; |
bb_end[b] = f->start_addr + f->bb[b].last * 4; |
//printf ("%i %x %x\n", b, bb_start[b], bb_end[b]); |
//PRINTF ("%i %x %x\n", b, bb_start[b], bb_end[b]); |
f->bb[0].cnt = 0; |
} |
|
1106,13 → 1106,13
buf = (struct mprofentry_struct *) malloc (sizeof (struct mprofentry_struct) * bufsize); |
assert (buf); |
|
//printf ("BBSEQ:\n"); |
//PRINTF ("BBSEQ:\n"); |
do { |
r = fread (buf, sizeof (struct mprofentry_struct), bufsize, fi); |
//printf ("r%i : ", r); |
//PRINTF ("r%i : ", r); |
for (i = 0; i < r; i++) { |
if (buf[i].type & MPROF_FETCH) { |
//printf ("%x, ", buf[i].addr); |
//PRINTF ("%x, ", buf[i].addr); |
if (buf[i].addr >= f->start_addr && buf[i].addr <= f->end_addr) { |
assert (buf[i].type & MPROF_32); |
prevaddr = addr; |
1127,7 → 1127,7
#warning TODO: do not count interrupts |
if (curbb != prevbb && curbb >= 0) { |
fwrite (&curbb, sizeof (unsigned long), 1, fo); |
//printf (" [%i] ", curbb); |
//PRINTF (" [%i] ", curbb); |
f->bb[curbb].cnt++; |
prevbb = curbb; |
} |
1137,9 → 1137,9
else mlcnt++, mlsum += cur_area->delayw; |
} |
} |
//printf ("\n"); |
//PRINTF ("\n"); |
} while (r == bufsize); |
//printf ("\n"); |
//PRINTF ("\n"); |
|
runtime.cuc.mdelay[0] = (1. * mlsum) / mlcnt; |
runtime.cuc.mdelay[1] = (1. * mlsum) / mlcnt; |
1153,7 → 1153,7
|
/* Initialize basic block relocations */ |
f->num_init_bb = f->num_bb; |
//printf ("num_init_bb = %i\n", f->num_init_bb); |
//PRINTF ("num_init_bb = %i\n", f->num_init_bb); |
assert (f->init_bb_reloc = (int *)malloc (sizeof (int) * f->num_init_bb)); |
for (b = 0; b < f->num_init_bb; b++) f->init_bb_reloc[b] = b; |
} |
1215,7 → 1215,7
cuc_insn *ii; |
|
assert (unroll > 1); |
//printf ("unroll BB%i x %i (num_bb %i)\n", b, unroll, n->num_bb); |
//PRINTF ("unroll BB%i x %i (num_bb %i)\n", b, unroll, n->num_bb); |
unroll--; |
assert (n->num_bb + unroll * 2 < MAX_BB); |
|
1359,7 → 1359,7
cuc_insn *ii; |
|
assert (preroll > 1); |
//printf ("preroll BB%i x %i (num_bb %i)\n", b, preroll, n->num_bb); |
//PRINTF ("preroll BB%i x %i (num_bb %i)\n", b, preroll, n->num_bb); |
preroll--; |
assert (n->num_bb + preroll * 2 < MAX_BB); |
|
/trunk/or1ksim/cuc/insn.c
87,23 → 87,23
int i, j; |
for (i = 0; i < ninsn; i++) { |
dep_list *l = insn[i].dep; |
printf ("%4x%c %-4s ", i, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i])); |
PRINTF ("%4x%c %-4s ", i, insn[i].index >= 0 ? ':' : '?', cuc_insn_name (&insn[i])); |
if (verbose) { |
printf ("%-20s insn = %08x, index = %i, type = %04x ", |
PRINTF ("%-20s insn = %08x, index = %i, type = %04x ", |
insn[i].disasm, insn[i].insn, insn[i].index, insn[i].type); |
} else printf ("type = %04x ", insn[i].type); |
} else PRINTF ("type = %04x ", insn[i].type); |
for (j = 0; j < MAX_OPERANDS; j++) { |
if (insn[i].opt[j] & OPT_DEST) printf ("*"); |
if (insn[i].opt[j] & OPT_DEST) PRINTF ("*"); |
switch (insn[i].opt[j] & ~OPT_DEST) { |
case OPT_NONE: break; |
case OPT_CONST: if (insn[i].type & IT_COND && (insn[i].index == II_CMOV |
|| insn[i].index == II_ADD)) printf ("%x, ", insn[i].op[j]); |
else printf ("0x%08x, ", insn[i].op[j]); break; |
case OPT_JUMP: printf ("J%x ", insn[i].op[j]); break; |
case OPT_REGISTER: printf ("r%i, ", insn[i].op[j]); break; |
case OPT_REF: printf ("[%x.%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break; |
case OPT_BB: printf ("BB "); print_bb_num (insn[i].op[j]); printf (", "); break; |
case OPT_LRBB: printf ("LRBB, "); break; |
|| insn[i].index == II_ADD)) PRINTF ("%x, ", insn[i].op[j]); |
else PRINTF ("0x%08x, ", insn[i].op[j]); break; |
case OPT_JUMP: PRINTF ("J%x ", insn[i].op[j]); break; |
case OPT_REGISTER: PRINTF ("r%i, ", insn[i].op[j]); break; |
case OPT_REF: PRINTF ("[%x.%x], ", REF_BB(insn[i].op[j]), REF_I(insn[i].op[j])); break; |
case OPT_BB: PRINTF ("BB "); print_bb_num (insn[i].op[j]); PRINTF (", "); break; |
case OPT_LRBB: PRINTF ("LRBB, "); break; |
default: |
fprintf (stderr, "Invalid operand type %s(%x.%x) = %x\n", |
cuc_insn_name (&insn[i]), i, j, insn[i].opt[j]); |
111,13 → 111,13
} |
} |
if (l) { |
printf ("\n\tdep:"); |
PRINTF ("\n\tdep:"); |
while (l) { |
printf (" [%x.%x],", REF_BB (l->ref), REF_I (l->ref)); |
PRINTF (" [%x.%x],", REF_BB (l->ref), REF_I (l->ref)); |
l = l->next; |
} |
} |
printf ("\n"); |
PRINTF ("\n"); |
} |
} |
|
863,9 → 863,9
} |
} |
if (cuc_debug >= 2) { |
printf ("saved regs "); |
for (i = 0; i < MAX_REGS; i++) printf ("%i:%i ", i, f->saved_regs[i]); |
printf ("\n"); |
PRINTF ("saved regs "); |
for (i = 0; i < MAX_REGS; i++) PRINTF ("%i:%i ", i, f->saved_regs[i]); |
PRINTF ("\n"); |
} |
return remove_nops (f); |
} |
1310,7 → 1310,7
{ |
int i, first = 1; |
for (i = 0; i < nshared; i++) { |
printf ("%s%s%s", first ? "" : "-", cuc_insn_name (&rf->INSN(shared[i].ref)), |
PRINTF ("%s%s%s", first ? "" : "-", cuc_insn_name (&rf->INSN(shared[i].ref)), |
shared[i].cmatch ? "!" : ""); |
first = 0; |
} |
1325,7 → 1325,7
{ |
int b, i, j, cnt = 0; |
#warning some code here (2) |
printf ("Replacing: "); |
PRINTF ("Replacing: "); |
print_shared (rf, shared, nshared); |
|
for (b = 0; b < f->num_bb; b++) |
1332,6 → 1332,6
for (i = 0; i < f->bb[b].ninsn; i++) { |
} |
|
printf ("\nFound %i matches.\n", cnt); |
PRINTF ("\nFound %i matches.\n", cnt); |
} |
|
/trunk/or1ksim/cuc/verilog.c
24,6 → 24,7
#include "cuc.h" |
#include "insn.h" |
#include "profiler.h" |
#include "sim-config.h" |
|
/* Shortcut */ |
#define GEN(x...) fprintf (fo, x) |
64,7 → 65,7
int x; |
GEN ("%sf_end[%i]", first ? " && " : "", find_lsc_index (f, t->ref)); |
} else { |
printf ("print_deps: err %x\n", t->ref); |
PRINTF ("print_deps: err %x\n", t->ref); |
assert (0); |
} |
first = 1; |
216,7 → 217,7
sprintf (tmp, "%s.v", filename); |
|
log ("Generating verilog file \"%s\"\n", tmp); |
printf ("Generating verilog file \"%s\"\n", tmp); |
PRINTF ("Generating verilog file \"%s\"\n", tmp); |
if ((fo = fopen (tmp, "wt+")) == NULL) { |
fprintf (stderr, "Cannot open '%s'\n", tmp); |
exit (1); |
542,7 → 543,7
char t[30]; |
GEN (" %sif (s_stb[%i]) swb_dat_o = %s;\n", i ? "else " : "", cur_store++, |
print_op_v (f, t, f->msched[i], 0)); |
//printf ("msched[%i] = %x (mtype %x) %x\n", i, f->msched[i], f->mtype[i], f->INSN(f->msched[i]).op[0]); |
//PRINTF ("msched[%i] = %x (mtype %x) %x\n", i, f->msched[i], f->mtype[i], f->INSN(f->msched[i]).op[0]); |
} |
GEN ("end\n"); |
} |
702,7 → 703,7
if (maxncallees < ncallees[i]) maxncallees = ncallees[i]; |
|
log ("Generating verilog file \"%s\"\n", tmp); |
printf ("Generating verilog file \"%s\"\n", tmp); |
PRINTF ("Generating verilog file \"%s\"\n", tmp); |
if ((fo = fopen (tmp, "wt+")) == NULL) { |
fprintf (stderr, "Cannot open '%s'\n", tmp); |
exit (1); |
/trunk/or1ksim/cuc/memory.c
102,7 → 102,7
if (insn[i].type & IT_MEMORY) { |
dep_list *tmp = all_mem; |
while (tmp) { |
//printf ("%x %x\n", REF (b,i), tmp->ref); |
//PRINTF ("%x %x\n", REF (b,i), tmp->ref); |
if (check_memory_conflict (f, &insn[i], &f->INSN(tmp->ref), otype)) |
add_dep (&insn[i].dep, tmp->ref); |
tmp = tmp->next; |
132,7 → 132,7
if (a->opt[1] != b->opt[1] || a->op[1] != b->op[1] |
|| a->opt[2] != OPT_CONST || b->opt[2] != OPT_CONST) goto keep; |
|
//printf ("%i %i, ", a->op[2], b->op[2]); |
//PRINTF ("%i %i, ", a->op[2], b->op[2]); |
|
/* Check if they are the same => do not copy */ |
if (a->op[2] == b->op[2] |
413,7 → 413,7
if (cuc_debug > 5) print_cuc_bb (f, "AFTER_MEM_REMOVAL"); |
|
if (config.cuc.enable_bursts) { |
//printf ("\n"); |
//PRINTF ("\n"); |
for (i = 1; i < f->nmsched; i++) { |
cuc_insn *a = &f->INSN(f->msched[i - 1]); |
cuc_insn *b = &f->INSN(f->msched[i]); |
430,7 → 430,7
if (a->opt[1] != b->opt[1] || a->op[1] != b->op[1] |
|| a->opt[2] != OPT_CONST || b->opt[2] != OPT_CONST) continue; |
|
//printf ("%i %i, ", a->op[2], b->op[2]); |
//PRINTF ("%i %i, ", a->op[2], b->op[2]); |
|
/* Check if they touch together */ |
if (a->op[2] + aw == b->op[2] |
509,7 → 509,7
add_dep (&f->INSN(f->msched[i]).dep, f->msched[maxc]); |
lastc[t] = maxc; |
} |
//printf ("%i(%i)> ml %i(%i) ms %i(%i) lastl %i %i lasts %i %i last_load %i last_store %i\n", i, f->msched[i], maxl, f->msched[maxl], maxs, f->msched[maxs], lastl[0], lastl[1], lasts[0], lasts[1], last_load, last_store); |
//PRINTF ("%i(%i)> ml %i(%i) ms %i(%i) lastl %i %i lasts %i %i last_load %i last_store %i\n", i, f->msched[i], maxl, f->msched[maxl], maxs, f->msched[maxs], lastl[0], lastl[1], lasts[0], lasts[1], last_load, last_store); |
|
/* What we have to wait to finish this BB? */ |
if (i + 1 >= f->nmsched || REF_BB(f->msched[i + 1]) != REF_BB(f->msched[i])) { |
/trunk/or1ksim/cuc/cuc.c
262,7 → 262,7
/* Sort the timings */ |
#if 0 |
if (cuc_debug >= 3) |
for (i = 0; i < nt; i++) printf ("%i:%i,%i: %icyc\n", |
for (i = 0; i < nt; i++) PRINTF ("%i:%i,%i: %icyc\n", |
t[i].b, t[i].preroll, t[i].unroll, t[i].new_time); |
#endif |
|
347,7 → 347,7
char tmp1[10]; |
char tmp2[10]; |
sprintf (tmp2, "%s", gen_option (tmp1, bb_no, f_opt)); |
printf ("%3s", tmp2); |
PRINTF ("%3s", tmp2); |
} |
|
static char *format_func_options (char *s, cuc_func *f) |
368,10 → 368,10
int b, i; |
char tmp[30]; |
char *name = prof_func[func_no].name; |
printf ("-----------------------------------------------------------------------------\n"); |
printf ("|%-28s|pre/unrolled|shared| time | gates |old_time|\n", |
PRINTF ("-----------------------------------------------------------------------------\n"); |
PRINTF ("|%-28s|pre/unrolled|shared| time | gates |old_time|\n", |
strstrip (tmp, name, 28)); |
printf ("| BASE |%4i / %4i | %4i |%8i|%8.f|%8i|\n", 1, 1, 0, |
PRINTF ("| BASE |%4i / %4i | %4i |%8i|%8.f|%8i|\n", 1, 1, 0, |
f->timings.new_time, f->timings.size, f->orig_time); |
for (b = 0; b < f->num_bb; b++) { |
/* Print out results */ |
378,9 → 378,9
for (i = 1; i < f->bb[b].ntim; i++) { /* First one is base option */ |
int time = f->bb[b].tim[i].new_time - f->timings.new_time; |
double size = f->bb[b].tim[i].size - f->timings.size; |
printf ("| "); |
PRINTF ("| "); |
print_option (b, i); |
printf (" |%4i / %4i | %4i |%+8i|%+8.f| |\n", |
PRINTF (" |%4i / %4i | %4i |%+8i|%+8.f| |\n", |
f->bb[b].tim[i].preroll, f->bb[b].tim[i].unroll, f->bb[b].tim[i].nshared, |
time, size); |
} |
398,11 → 398,11
|
if (cuc_debug >= 2) print_cuc_bb (f, "BEFORE_GENERATE"); |
log ("Generating function %s.\n", name); |
printf ("Generating function %s.\n", name); |
PRINTF ("Generating function %s.\n", name); |
|
format_func_options (tmp, rf); |
if (strlen (tmp)) printf ("Applying options: %s\n", tmp); |
else printf ("Using basic options.\n"); |
if (strlen (tmp)) PRINTF ("Applying options: %s\n", tmp); |
else PRINTF ("Using basic options.\n"); |
|
/* Generate function as specified by options */ |
for (b = 0; b < f->num_bb; b++) { |
560,18 → 560,18
} |
} |
|
printf ("Entering OpenRISC Custom Unit Compiler command prompt\n"); |
printf ("Using profile file \"%s\" and memory profile file \"%s\".\n", config.sim.prof_fn, config.sim.mprof_fn); |
PRINTF ("Entering OpenRISC Custom Unit Compiler command prompt\n"); |
PRINTF ("Using profile file \"%s\" and memory profile file \"%s\".\n", config.sim.prof_fn, config.sim.mprof_fn); |
sprintf (tmp1, "%s.log", filename_cut); |
printf ("Analyzing. (log file \"%s\").\n", tmp1); |
PRINTF ("Analyzing. (log file \"%s\").\n", tmp1); |
assert (flog = fopen (tmp1, "wt+")); |
|
/* Loads in the specified timings table */ |
printf ("Using timings from \"%s\" at %s\n",config.cuc.timings_fn, |
PRINTF ("Using timings from \"%s\" at %s\n",config.cuc.timings_fn, |
generate_time_pretty (tmp1, config.sim.clkcycle_ps)); |
load_timing_table (config.cuc.timings_fn); |
runtime.cuc.cycle_duration = 1000. * config.sim.clkcycle_ps; |
printf ("Multicycle logic %s, bursts %s, %s memory order.\n", |
PRINTF ("Multicycle logic %s, bursts %s, %s memory order.\n", |
config.cuc.no_multicycle ? "OFF" : "ON", config.cuc.enable_bursts ? "ON" : "OFF", |
config.cuc.memory_order == MO_NONE ? "no" : config.cuc.memory_order == MO_WEAK ? "weak" : |
config.cuc.memory_order == MO_STRONG ? "strong" : "exact"); |
581,7 → 581,7
cuc_debug = 0; |
|
if (config.cuc.calling_convention) |
printf ("Assuming OpenRISC standard calling convention.\n"); |
PRINTF ("Assuming OpenRISC standard calling convention.\n"); |
|
/* Try all functions except "total" */ |
for (i = 0; i < prof_nfuncs - 1; i++) { |
595,7 → 595,7
end_addr = extract_function (tmp1, start_addr); |
|
log ("Testing function %s (%08x - %08x)\n", prof_func[i].name, start_addr, end_addr); |
printf ("Testing function %s (%08x - %08x)\n", prof_func[i].name, start_addr, end_addr); |
PRINTF ("Testing function %s (%08x - %08x)\n", prof_func[i].name, start_addr, end_addr); |
func[i] = analyse_function (prof_func[i].name, orig_time, start_addr, |
end_addr, config.cuc.memory_order); |
func_v[i] = 0; |
605,7 → 605,7
while (1) { |
char *s; |
wait_command: |
printf ("(cuc) "); |
PRINTF ("(cuc) "); |
fflush (stdout); |
fgets(tmp1, sizeof tmp1, stdin); |
for (s = tmp1; *s != '\0' && *s != '\n' && *s != '\r'; s++); |
619,9 → 619,9
} else if (strcmp (tmp1, "p") == 0 || strcmp (tmp1, "profile") == 0) { |
int ntime = 0; |
int size = 0; |
printf ("-----------------------------------------------------------------------------\n"); |
printf ("|function name |calls|avg cycles |old%| max. f. | impr. f.| options |\n"); |
printf ("|--------------------+-----+------------+----+----------|---------+---------|\n"); |
PRINTF ("-----------------------------------------------------------------------------\n"); |
PRINTF ("|function name |calls|avg cycles |old%| max. f. | impr. f.| options |\n"); |
PRINTF ("|--------------------+-----+------------+----+----------|---------+---------|\n"); |
for (j = 0; j < prof_nfuncs; j++) { |
int bestcyc = 0, besti = 0; |
char tmp[100]; |
631,7 → 631,7
besti = i; |
} |
i = besti; |
printf ("|%-20s|%5i|%12.1f|%3.0f%%| ", |
PRINTF ("|%-20s|%5i|%12.1f|%3.0f%%| ", |
strstrip (tmp, prof_func[i].name, 20), prof_func[i].calls, |
((double)prof_func[i].cum_cycles / prof_func[i].calls), |
(100. * prof_func[i].cum_cycles / prof_cycles)); |
644,10 → 644,10
ntime += nt * func[i]->num_runs; |
size += s; |
} else ntime += prof_func[i].cum_cycles; |
printf ("%8.1f |%8.1f | %-8s|\n", 1.f * prof_func[i].cum_cycles |
PRINTF ("%8.1f |%8.1f | %-8s|\n", 1.f * prof_func[i].cum_cycles |
/ func[i]->timings.new_time, f, format_func_options (tmp, func[i])); |
} else { |
printf (" N/A | N/A | N/A |\n"); |
PRINTF (" N/A | N/A | N/A |\n"); |
ntime += prof_func[i].cum_cycles; |
} |
prof_func[i].cum_cycles = -prof_func[i].cum_cycles; |
654,8 → 654,8
} |
for (i = 0; i < prof_nfuncs; i++) |
prof_func[i].cum_cycles = -prof_func[i].cum_cycles; |
printf ("-----------------------------------------------------------------------------\n"); |
printf ("Total %i cycles (was %i), total added gates = %i. Speed factor %.1f\n", |
PRINTF ("-----------------------------------------------------------------------------\n"); |
PRINTF ("Total %i cycles (was %i), total added gates = %i. Speed factor %.1f\n", |
ntime, prof_cycles, size, 1. * prof_cycles / ntime); |
|
/* debug command */ |
672,7 → 672,7
for (i = 0; i < prof_nfuncs; i++) if (func[i]) |
for (j = 0; j < func[i]->nfdeps; j++) |
if (!func[i]->fdeps[j] || !func[i]->fdeps[j]->tmp) { |
printf ("Function %s must be selected for translation (required by %s)\n", |
PRINTF ("Function %s must be selected for translation (required by %s)\n", |
prof_func[j].name, prof_func[i].name); |
goto wait_command; |
} |
686,7 → 686,7
int p, o, b, f; |
for (f = 0; f < prof_nfuncs; f++) if (func[f]) { |
func_v[f] = 1; |
printf ("Function %s selected for translation.\n", prof_func[f].name); |
PRINTF ("Function %s selected for translation.\n", prof_func[f].name); |
} |
|
/* select command */ |
694,7 → 694,7
char tmp[50], ch; |
int p, o, b, f; |
p = sscanf (tmp1, "%*s %s %i%c", tmp, &b, &ch); |
if (p < 1) printf ("Invalid parameters.\n"); |
if (p < 1) PRINTF ("Invalid parameters.\n"); |
else { |
/* Check if we have valid option */ |
for (f = 0; f < prof_nfuncs; f++) |
703,11 → 703,11
if (p == 1) { |
if (func[f]) { |
func_v[f] = 1; |
printf ("Function %s selected for translation.\n", prof_func[f].name); |
} else printf ("Function %s not suitable for translation.\n", prof_func[f].name); |
PRINTF ("Function %s selected for translation.\n", prof_func[f].name); |
} else PRINTF ("Function %s not suitable for translation.\n", prof_func[f].name); |
} else { |
if (!func_v[f]) |
printf ("Function %s not yet selected for translation.\n", prof_func[f].name); |
PRINTF ("Function %s not yet selected for translation.\n", prof_func[f].name); |
if (p < 3) goto invalid_option; |
for (o = 0; option_char[o] != '\0' && option_char[o] != ch; o++); |
if (!option_char[o]) goto invalid_option; |
717,15 → 717,15
/* select an option */ |
func[f]->bb[b].selected_tim = o; |
if (func[f]->bb[b].tim[o].nshared) { |
printf ("Option has shared instructions: "); |
PRINTF ("Option has shared instructions: "); |
print_shared (func[f], func[f]->bb[b].tim[o].shared, func[f]->bb[b].tim[o].nshared); |
printf ("\n"); |
PRINTF ("\n"); |
} |
goto wait_command; |
invalid_option: |
printf ("Invalid option.\n"); |
PRINTF ("Invalid option.\n"); |
} |
} else printf ("Invalid function.\n"); |
} else PRINTF ("Invalid function.\n"); |
} |
|
/* unselect command */ |
733,7 → 733,7
char tmp[50], ch; |
int p, o, b, f; |
p = sscanf (tmp1, "%*s %s %i%c", tmp, &b, &ch); |
if (p < 1) printf ("Invalid parameters.\n"); |
if (p < 1) PRINTF ("Invalid parameters.\n"); |
else { |
/* Check if we have valid option */ |
for (f = 0; f < prof_nfuncs; f++) |
742,8 → 742,8
if (p == 1) { |
if (func[f]) { |
func_v[f] = 0; |
printf ("Function %s unselected for translation.\n", prof_func[f].name); |
} else printf ("Function %s not suitable for translation.\n", prof_func[f].name); |
PRINTF ("Function %s unselected for translation.\n", prof_func[f].name); |
} else PRINTF ("Function %s not suitable for translation.\n", prof_func[f].name); |
} else { |
if (p < 3) goto invalid_option; |
for (o = 0; option_char[o] != '\0' && option_char[o] != ch; o++); |
754,20 → 754,20
/* select an option */ |
func[f]->bb[b].selected_tim = -1; |
} |
} else printf ("Invalid function.\n"); |
} else PRINTF ("Invalid function.\n"); |
} |
|
/* options command */ |
} else if (strcmp (tmp1, "o") == 0 || strcmp (tmp1, "options") == 0) { |
int any = 0; |
printf ("Available options:\n"); |
PRINTF ("Available options:\n"); |
for (i = 0; i < prof_nfuncs; i++) |
if (func[i]) { |
options_cmd (i, func[i]); |
any = 1; |
} |
if (any) printf ("-----------------------------------------------------------------------------\n"); |
else printf ("Sorry. No available options.\n"); |
if (any) PRINTF ("-----------------------------------------------------------------------------\n"); |
else PRINTF ("Sorry. No available options.\n"); |
|
/* Ignore empty string */ |
} else if (strcmp (tmp1, "") == 0) { |
775,17 → 775,17
/* help command */ |
} else { |
if (strcmp (tmp1, "h") != 0 && strcmp (tmp1, "help") != 0) |
printf ("Unknown command.\n"); |
printf ("OpenRISC Custom Unit Compiler command prompt\n"); |
printf ("Available commands:\n"); |
printf (" h | help displays this help\n"); |
printf (" q | quit returns to or1ksim prompt\n"); |
printf (" p | profile displays function profiling\n"); |
printf (" d | debug # sets debug level (0-9)\n"); |
printf (" o | options displays available options\n"); |
printf (" s | select func [option] selects an option/function\n"); |
printf (" u | unselect func [option] unselects an option/function\n"); |
printf (" g | generate generates verilog file\n"); |
PRINTF ("Unknown command.\n"); |
PRINTF ("OpenRISC Custom Unit Compiler command prompt\n"); |
PRINTF ("Available commands:\n"); |
PRINTF (" h | help displays this help\n"); |
PRINTF (" q | quit returns to or1ksim prompt\n"); |
PRINTF (" p | profile displays function profiling\n"); |
PRINTF (" d | debug # sets debug level (0-9)\n"); |
PRINTF (" o | options displays available options\n"); |
PRINTF (" s | select func [option] selects an option/function\n"); |
PRINTF (" u | unselect func [option] unselects an option/function\n"); |
PRINTF (" g | generate generates verilog file\n"); |
} |
} |
|
/trunk/or1ksim/cuc/timings.c
76,7 → 76,7
if (d[i] > max_d) max_d = d[i]; |
} |
free (d); |
//printf ("max_d%i=%f\n", b, max_d); |
//PRINTF ("max_d%i=%f\n", b, max_d); |
return max_d; |
} |
|
95,7 → 95,7
else d += runtime.cuc.mdelay[1]; |
} |
} |
//printf ("md%i=%i\n", b, d); |
//PRINTF ("md%i=%i\n", b, d); |
return d; |
} |
|
129,9 → 129,9
} |
} |
} |
//printf ("%2x md%.1f ", i, md); |
//PRINTF ("%2x md%.1f ", i, md); |
md += insn_time (&bb->insn[i]); |
//printf ("md%.1f mg%i %.1f\n", md, mg, sd); |
//PRINTF ("md%.1f mg%i %.1f\n", md, mg, sd); |
bb->insn[i].tmp = mg; |
if (md > sd) { |
bb->insn[i].type |= IT_CUT; |
279,7 → 279,7
i = index; |
if (fscanf (fi, "%lf%lf%lf%lf\n", &timing_table[i].size, |
&timing_table[i].sizei, &timing_table[i].delay, &timing_table[i].delayi) != 4) break; |
/*printf ("!%s size %f,%f delay %f,%f\n", known[i].name, timing_table[i].size, |
/*PRINTF ("!%s size %f,%f delay %f,%f\n", known[i].name, timing_table[i].size, |
timing_table[i].sizei, timing_table[i].delay, timing_table[i].delayi);*/ |
} |
|
287,7 → 287,7
for (i = 0; i <= II_LAST; i++) { |
assert (timing_table[i].size >= 0 && timing_table[i].sizei >= 0 |
&& timing_table[i].delay >= 0 && timing_table[i].delayi >= 0); |
/*printf ("%s size %f,%f delay %f,%f\n", known[i], timing_table[i].size, |
/*PRINTF ("%s size %f,%f delay %f,%f\n", known[i], timing_table[i].size, |
timing_table[i].sizei, timing_table[i].delay, timing_table[i].delayi);*/ |
} |
|
/trunk/or1ksim/pic/pic.c
35,7 → 35,7
/* Reset. It initializes PIC registers. */ |
void pic_reset() |
{ |
printf("Resetting PIC.\n"); |
PRINTF("Resetting PIC.\n"); |
mtspr(SPR_PICMR, 0); |
mtspr(SPR_PICPR, 0); |
mtspr(SPR_PICSR, 0); |
/trunk/or1ksim/pm/pm.c
34,6 → 34,6
/* Reset. It initializes PMR register. */ |
void pm_reset() |
{ |
if (config.sim.verbose) printf("Resetting Power Management.\n"); |
if (config.sim.verbose) PRINTF("Resetting Power Management.\n"); |
mtspr(SPR_PMR, 0); |
} |
/trunk/or1ksim/testbench/mmu.c
54,7 → 54,7
SPR_ITLBTR_UXE ) |
|
#if 1 |
#define debug printf |
#define debug PRINTF |
#else |
#define debug |
#endif |
/trunk/or1ksim/testbench/dmatest.c
152,16 → 152,16
int main() |
{ |
int pass_simple, pass_chunks, pass_list; |
printf( "Starting DMA test\n" ); |
PRINTF( "Starting DMA test\n" ); |
|
printf( " Simple DMA: " ); |
printf( (pass_simple = simple()) ? "Passed\n" : "Failed\n" ); |
printf( " Chunks DMA: " ); |
printf( (pass_chunks = chunks()) ? "Passed\n" : "Failed\n" ); |
printf( " List DMA: " ); |
printf( (pass_list = list()) ? "Passed\n" : "Failed\n" ); |
PRINTF( " Simple DMA: " ); |
PRINTF( (pass_simple = simple()) ? "Passed\n" : "Failed\n" ); |
PRINTF( " Chunks DMA: " ); |
PRINTF( (pass_chunks = chunks()) ? "Passed\n" : "Failed\n" ); |
PRINTF( " List DMA: " ); |
PRINTF( (pass_list = list()) ? "Passed\n" : "Failed\n" ); |
|
printf( "Ending DMA test\n" ); |
PRINTF( "Ending DMA test\n" ); |
if (pass_simple && pass_chunks && pass_list) { |
report (0xdeaddead); |
return 0; |
/trunk/or1ksim/testbench/dhry.c
156,20 → 156,20
/* Initalize Data and Instruction Cache */ |
|
|
/* printf ("\n"); |
printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n"); |
printf ("\n"); |
/* PRINTF ("\n"); |
PRINTF ("Dhrystone Benchmark, Version 2.1 (Language: C)\n"); |
PRINTF ("\n"); |
if (Reg) |
{ |
printf ("Program compiled with 'register' attribute\n"); |
printf ("\n"); |
PRINTF ("Program compiled with 'register' attribute\n"); |
PRINTF ("\n"); |
} |
else |
{ |
printf ("Program compiled without 'register' attribute\n"); |
printf ("\n"); |
PRINTF ("Program compiled without 'register' attribute\n"); |
PRINTF ("\n"); |
} |
printf ("Please give the number of runs through the benchmark: "); |
PRINTF ("Please give the number of runs through the benchmark: "); |
*/ |
{ |
int n; |
178,9 → 178,9
n = NUM_RUNS; |
Number_Of_Runs = n; |
} |
printf ("\n"); |
PRINTF ("\n"); |
|
printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); |
PRINTF ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); |
|
|
/***************/ |
187,7 → 187,7
/* Start timer */ |
/***************/ |
|
/* printf("%d", my_test2(Number_Of_Runs));*/ |
/* PRINTF("%d", my_test2(Number_Of_Runs));*/ |
start_timer(TIMER0); |
Begin_Time = read_timer(TIMER0); |
|
223,24 → 223,24
report(5); |
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ |
#if DBG |
printf("a) Int_1_Loc: %x\n", Int_1_Loc); |
printf("a) Int_2_Loc: %x\n", Int_2_Loc); |
printf("a) Int_3_Loc: %x\n\n", Int_3_Loc); |
PRINTF("a) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("a) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("a) Int_3_Loc: %x\n\n", Int_3_Loc); |
#endif |
Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc); |
/* Int_Glob == 5 */ |
#if DBG |
printf("b) Int_1_Loc: %x\n", Int_1_Loc); |
printf("b) Int_2_Loc: %x\n", Int_2_Loc); |
printf("b) Int_3_Loc: %x\n\n", Int_3_Loc); |
PRINTF("b) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("b) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("b) Int_3_Loc: %x\n\n", Int_3_Loc); |
#endif |
report(6); |
|
Proc_1 (Ptr_Glob); |
#if DBG |
printf("c) Int_1_Loc: %x\n", Int_1_Loc); |
printf("c) Int_2_Loc: %x\n", Int_2_Loc); |
printf("c) Int_3_Loc: %x\n\n", Int_3_Loc); |
PRINTF("c) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("c) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("c) Int_3_Loc: %x\n\n", Int_3_Loc); |
#endif |
report(7); |
|
255,9 → 255,9
Int_2_Loc = Run_Index; |
Int_Glob = Run_Index; |
#if DBG |
printf("d) Int_1_Loc: %x\n", Int_1_Loc); |
printf("d) Int_2_Loc: %x\n", Int_2_Loc); |
printf("d) Int_3_Loc: %x\n\n", Int_3_Loc); |
PRINTF("d) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("d) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("d) Int_3_Loc: %x\n\n", Int_3_Loc); |
#endif |
} |
} |
265,10 → 265,10
|
/* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ |
#if DBG |
printf("e) Int_1_Loc: %x\n", Int_1_Loc); |
printf("e) Int_2_Loc: %x\n", Int_2_Loc); |
printf("e) Int_3_Loc: %x\n", Int_3_Loc); |
printf("e) Ch_1_Glob: %c\n\n", Ch_1_Glob); |
PRINTF("e) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("e) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("e) Int_3_Loc: %x\n", Int_3_Loc); |
PRINTF("e) Ch_1_Glob: %c\n\n", Ch_1_Glob); |
#endif |
Int_2_Loc = Int_2_Loc * Int_1_Loc; |
Int_1_Loc = Int_2_Loc / Int_3_Loc; |
279,9 → 279,9
|
/* Int_1_Loc == 5 */ |
#if DBG |
printf("f) Int_1_Loc: %x\n", Int_1_Loc); |
printf("f) Int_2_Loc: %x\n", Int_2_Loc); |
printf("f) Int_3_Loc: %x\n\n", Int_3_Loc); |
PRINTF("f) Int_1_Loc: %x\n", Int_1_Loc); |
PRINTF("f) Int_2_Loc: %x\n", Int_2_Loc); |
PRINTF("f) Int_3_Loc: %x\n\n", Int_3_Loc); |
#endif |
|
} /* loop "for Run_Index" */ |
292,57 → 292,57
|
End_Time = read_timer(TIMER0); |
|
/* printf ("Execution ends\n"); |
printf ("\n"); |
printf ("Final values of the variables used in the benchmark:\n"); |
printf ("\n"); |
printf ("Int_Glob: %d\n", Int_Glob); |
printf (" should be: %d\n", 5); |
printf ("Bool_Glob: %d\n", Bool_Glob); |
printf (" should be: %d\n", 1); |
printf ("Ch_1_Glob: %c\n", Ch_1_Glob); |
printf (" should be: %c\n", 'A'); |
printf ("Ch_2_Glob: %c\n", Ch_2_Glob); |
printf (" should be: %c\n", 'B'); |
printf ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]); |
printf (" should be: %d\n", 7); |
printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]); |
printf (" should be: Number_Of_Runs + 10\n"); |
printf ("Ptr_Glob->\n"); |
printf (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp); |
printf (" should be: (implementation-dependent)\n"); |
printf (" Discr: %d\n", Ptr_Glob->Discr); |
printf (" should be: %d\n", 0); |
printf (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp); |
printf (" should be: %d\n", 2); |
printf (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp); |
printf (" should be: %d\n", 17); |
printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp); |
printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); |
printf ("Next_Ptr_Glob->\n"); |
printf (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp); |
printf (" should be: (implementation-dependent), same as above\n"); |
printf (" Discr: %d\n", Next_Ptr_Glob->Discr); |
printf (" should be: %d\n", 0); |
printf (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp); |
printf (" should be: %d\n", 1); |
printf (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp); |
printf (" should be: %d\n", 18); |
printf (" Str_Comp: %s\n", |
/* PRINTF ("Execution ends\n"); |
PRINTF ("\n"); |
PRINTF ("Final values of the variables used in the benchmark:\n"); |
PRINTF ("\n"); |
PRINTF ("Int_Glob: %d\n", Int_Glob); |
PRINTF (" should be: %d\n", 5); |
PRINTF ("Bool_Glob: %d\n", Bool_Glob); |
PRINTF (" should be: %d\n", 1); |
PRINTF ("Ch_1_Glob: %c\n", Ch_1_Glob); |
PRINTF (" should be: %c\n", 'A'); |
PRINTF ("Ch_2_Glob: %c\n", Ch_2_Glob); |
PRINTF (" should be: %c\n", 'B'); |
PRINTF ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]); |
PRINTF (" should be: %d\n", 7); |
PRINTF ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]); |
PRINTF (" should be: Number_Of_Runs + 10\n"); |
PRINTF ("Ptr_Glob->\n"); |
PRINTF (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp); |
PRINTF (" should be: (implementation-dependent)\n"); |
PRINTF (" Discr: %d\n", Ptr_Glob->Discr); |
PRINTF (" should be: %d\n", 0); |
PRINTF (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp); |
PRINTF (" should be: %d\n", 2); |
PRINTF (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp); |
PRINTF (" should be: %d\n", 17); |
PRINTF (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp); |
PRINTF (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); |
PRINTF ("Next_Ptr_Glob->\n"); |
PRINTF (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp); |
PRINTF (" should be: (implementation-dependent), same as above\n"); |
PRINTF (" Discr: %d\n", Next_Ptr_Glob->Discr); |
PRINTF (" should be: %d\n", 0); |
PRINTF (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp); |
PRINTF (" should be: %d\n", 1); |
PRINTF (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp); |
PRINTF (" should be: %d\n", 18); |
PRINTF (" Str_Comp: %s\n", |
Next_Ptr_Glob->variant.var_1.Str_Comp); |
printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); |
printf ("Int_1_Loc: %d\n", Int_1_Loc); |
printf (" should be: %d\n", 5); |
printf ("Int_2_Loc: %d\n", Int_2_Loc); |
printf (" should be: %d\n", 13); |
printf ("Int_3_Loc: %d\n", Int_3_Loc); |
printf (" should be: %d\n", 7); |
printf ("Enum_Loc: %d\n", Enum_Loc); |
printf (" should be: %d\n", 1); |
printf ("Str_1_Loc: %s\n", Str_1_Loc); |
printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n"); |
printf ("Str_2_Loc: %s\n", Str_2_Loc); |
printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n"); |
PRINTF (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); |
PRINTF ("Int_1_Loc: %d\n", Int_1_Loc); |
PRINTF (" should be: %d\n", 5); |
PRINTF ("Int_2_Loc: %d\n", Int_2_Loc); |
PRINTF (" should be: %d\n", 13); |
PRINTF ("Int_3_Loc: %d\n", Int_3_Loc); |
PRINTF (" should be: %d\n", 7); |
PRINTF ("Enum_Loc: %d\n", Enum_Loc); |
PRINTF (" should be: %d\n", 1); |
PRINTF ("Str_1_Loc: %s\n", Str_1_Loc); |
PRINTF (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n"); |
PRINTF ("Str_2_Loc: %s\n", Str_2_Loc); |
PRINTF (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n"); |
|
*/ |
|
350,15 → 350,15
User_Time = End_Time - Begin_Time; |
/* microseconds */ |
|
printf("Begin Time = %d\n",Begin_Time); |
printf("End Time = %d\n",End_Time); |
PRINTF("Begin Time = %d\n",Begin_Time); |
PRINTF("End Time = %d\n",End_Time); |
|
|
if (User_Time < Too_Small_Time) |
{ |
printf ("Measured time too small to obtain meaningful results\n"); |
printf ("Please increase number of runs\n"); |
printf ("\n"); |
PRINTF ("Measured time too small to obtain meaningful results\n"); |
PRINTF ("Please increase number of runs\n"); |
PRINTF ("\n"); |
} |
else |
{ |
365,25 → 365,25
#if DLX || OR1K |
User_Time /= DLX_FREQ; |
#if DLX |
printf("DLX "); |
PRINTF("DLX "); |
#else |
#if OR1K |
printf("OR1K "); |
PRINTF("OR1K "); |
#else |
printf("Unknown CPU "); |
PRINTF("Unknown CPU "); |
#endif |
#endif |
printf("at %u MHz ", DLX_FREQ); |
PRINTF("at %u MHz ", DLX_FREQ); |
if (PROC_6) |
printf("(+PROC_6)"); |
printf("\n"); |
PRINTF("(+PROC_6)"); |
PRINTF("\n"); |
#endif |
Microseconds = User_Time / Number_Of_Runs; |
Dhrystones_Per_Second = Number_Of_Runs * 1000 / User_Time; |
printf ("Microseconds for one run through Dhrystone: "); |
printf ("%d us / %d runs\n", User_Time,Number_Of_Runs); |
printf ("Dhrystones per Second: "); |
printf ("%d \n", Dhrystones_Per_Second); |
PRINTF ("Microseconds for one run through Dhrystone: "); |
PRINTF ("%d us / %d runs\n", User_Time,Number_Of_Runs); |
PRINTF ("Dhrystones per Second: "); |
PRINTF ("%d \n", Dhrystones_Per_Second); |
} |
report (0xdeaddead); |
return 0; |
608,8 → 608,8
REG One_Fifty Int_Loc; |
|
#if DBG |
printf("X) Int_1_Par_Val: %x\n", Int_1_Par_Val); |
printf("X) Int_2_Par_Val: %x\n", Int_2_Par_Val); |
PRINTF("X) Int_1_Par_Val: %x\n", Int_1_Par_Val); |
PRINTF("X) Int_2_Par_Val: %x\n", Int_2_Par_Val); |
#endif |
|
report(0x20080); |
625,8 → 625,8
Int_Glob = 5; |
|
#if DBG |
printf("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val); |
printf("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val); |
PRINTF("Y) Int_1_Par_Val: %x\n", Int_1_Par_Val); |
PRINTF("Y) Int_2_Par_Val: %x\n", Int_2_Par_Val); |
#endif |
|
} /* Proc_8 */ |
/trunk/or1ksim/testbench/mc_common.c
88,7 → 88,7
pattern32 = pattern16 = pattern = 0; inc = 1; break; |
} /*switch*/ |
|
printf ("\tmc_test_row_8(0x%02dX, %d, 0x%08lX, 0x%08lX);\n", pattern, seq, nFrom, nTo); |
PRINTF ("\tmc_test_row_8(0x%02dX, %d, 0x%08lX, 0x%08lX);\n", pattern, seq, nFrom, nTo); |
|
switch (seq) { |
case 0: /*seq. row write, row read*/ |
104,7 → 104,7
read = *mem8; |
|
if ( read != pattern ) { |
printf("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
PRINTF("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
return (unsigned long)mem8; |
} |
|
118,7 → 118,7
read = *mem8; |
|
if (read != pattern ) { |
printf("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
PRINTF("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
return (unsigned long)mem8; |
} |
|
125,13 → 125,13
mem16 = (unsigned short*)(i & 0xFFFFFFFELU); |
read16 = *mem16; |
if (read16 != pattern16) { |
printf("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
PRINTF("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
return (unsigned long)mem16; |
} |
mem32 = (unsigned long*)(i & 0xFFFFFFFCLU); |
read32 = *mem32; |
if (read32 != pattern32) { |
printf("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
PRINTF("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
return (unsigned long)mem32; |
} |
|
159,7 → 159,7
read = *mem8; |
|
if (read != pattern ) { |
printf("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
PRINTF("\ti=%lX, read=0x%02dX, pattern=0x%02dX\n", i, read, pattern); |
return (unsigned long)mem8; |
} |
|
203,7 → 203,7
pattern16 = pattern32 = 0; inc = 1; break; |
} /*switch*/ |
|
printf ("\tmc_test_row_16(0x%04dX, %d, 0x%08lX, 0x%08lX);\n", pattern16, seq, nFrom, nTo); |
PRINTF ("\tmc_test_row_16(0x%04dX, %d, 0x%08lX, 0x%08lX);\n", pattern16, seq, nFrom, nTo); |
|
switch (seq) { |
case 0: /*seq. row write, row read*/ |
219,7 → 219,7
read16 = *mem16; |
|
if ( read16 != pattern16 ) { |
printf("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
PRINTF("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
return (unsigned long)mem16; |
} |
|
233,7 → 233,7
read16 = *mem16; |
|
if (read16 != pattern16 ) { |
printf("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
PRINTF("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
return (unsigned long)mem16; |
} |
|
240,7 → 240,7
mem32 = (unsigned long*)(i & 0xFFFFFFFCLU); |
read32 = *mem32; |
if (read32 != pattern32) { |
printf("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
PRINTF("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
return (unsigned long)mem32; |
} |
|
260,7 → 260,7
read16 = *mem16; |
|
if (read16 != pattern16 ) { |
printf("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
PRINTF("\ti=%lX, read16=0x%04dX, pattern16=0x%04dX\n", i, read16, pattern16); |
return (unsigned long)mem16; |
} |
|
296,7 → 296,7
pattern32 = nFrom; inc = 1; break; |
} /*switch*/ |
|
printf ("\tmc_test_row_32(0x%08lX, %d, 0x%08lX, 0x%08lX);\n", pattern32, seq, nFrom, nTo); |
PRINTF ("\tmc_test_row_32(0x%08lX, %d, 0x%08lX, 0x%08lX);\n", pattern32, seq, nFrom, nTo); |
|
switch (seq) { |
case 0: /*seq. row write, row read*/ |
312,7 → 312,7
read32 = *mem32; |
|
if ( read32 != pattern32 ) { |
printf("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
PRINTF("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
return (unsigned long)mem32; |
} |
|
326,7 → 326,7
read32 = *mem32; |
|
if (read32 != pattern32 ) { |
printf("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
PRINTF("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
return (unsigned long)mem32; |
} |
|
343,7 → 343,7
read32 = *mem32; |
|
if (read32 != pattern32 ) { |
printf("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
PRINTF("\ti=%lX, read32=0x%08lX, pattern32=0x%08lX\n", i, read32, pattern32); |
return (unsigned long)mem32; |
} |
} /*for*/ |
362,7 → 362,7
int nRun, nSize, nSeq; |
int ret = 0; |
|
printf("\nmc_test_row(0x%08lX, 0x%08lX)\n", nFrom, nTo); |
PRINTF("\nmc_test_row(0x%08lX, 0x%08lX)\n", nFrom, nTo); |
|
for (nRun = 0; nRun < 5; nRun++) { |
switch (nRun) { |
/trunk/or1ksim/testbench/dhry.h
26,7 → 26,7
* |
* In this C version, the following C library functions are used: |
* - strcpy, strcmp (inside the measurement loop) |
* - printf, scanf (outside the measurement loop) |
* - PRINTF, scanf (outside the measurement loop) |
* In addition, Berkeley UNIX system calls "times ()" or "time ()" |
* are used for execution time measurement. For measurements |
* on other systems, these calls have to be changed. |
/trunk/or1ksim/testbench/eth.c
42,18 → 42,18
{ |
unsigned i,len; |
|
printf ("Int\n"); |
PRINTF ("Int\n"); |
switch (*eth_int_source & 0x7f) { |
case 0x2 : |
printf ("Transmit Error.\n"); |
PRINTF ("Transmit Error.\n"); |
*eth_int_source = 0x2; |
break; |
case 0x8 : |
printf ("Receive Error\n"); |
PRINTF ("Receive Error\n"); |
*eth_int_source = 0x8; |
break; |
case 0x4 : |
printf ("Receive Frame\n"); |
PRINTF ("Receive Frame\n"); |
*eth_int_source = 0x4; |
|
CLEAR_FLAG(*eth_moder, ETH_MODER, RXEN); |
62,22 → 62,22
for (i=0; i<len; i++) |
if (r_packet[i] != (unsigned char)i) |
{ |
printf("Failed at byte %d. expect %d, received %d\n", i, i, r_packet[i]); |
PRINTF("Failed at byte %d. expect %d, received %d\n", i, i, r_packet[i]); |
exit(1); |
} |
break; |
case 0x10: |
printf ("Busy\n"); |
PRINTF ("Busy\n"); |
*eth_int_source = 0x10; |
break; |
case 0x1 : |
printf ("Transmit Frame.\n"); |
PRINTF ("Transmit Frame.\n"); |
*eth_int_source = 0x1; |
CLEAR_FLAG(*eth_moder, ETH_MODER, TXEN); |
|
break; |
default: |
printf ("Invalid int @ %0x\n", (unsigned int)*eth_int_source & 0x7f); |
PRINTF ("Invalid int @ %0x\n", (unsigned int)*eth_int_source & 0x7f); |
*eth_int_source = 0x7f; |
exit (1); |
} |
120,17 → 120,17
|
int_happend = 0; |
/* Initialize packet */ |
printf("Init\n"); |
PRINTF("Init\n"); |
for ( i = 0; i < sizeof(s_packet); ++ i ) |
s_packet[i] = (unsigned char)i; |
|
/* Set Ethernet BD */ |
printf("Set BD\n"); |
PRINTF("Set BD\n"); |
SET_FIELD(eth_bd_base[tx_bindex], ETH_TX_BD, LENGTH, sizeof(s_packet)); |
eth_bd_base[tx_bindex + 1] = (unsigned long)s_packet; |
|
/* Start Ethernet */ |
printf("Set Flags\n"); |
PRINTF("Set Flags\n"); |
SET_FLAG(eth_bd_base[tx_bindex], ETH_TX_BD, IRQ); |
SET_FLAG(eth_bd_base[tx_bindex], ETH_TX_BD, READY); |
SET_FLAG(*eth_moder, ETH_MODER, TXEN); |
155,7 → 155,7
for (i=0; i<len; i++) |
if (r_packet[i] != (unsigned char)i) |
{ |
printf("Failed at byte %d. expect %d, received %d\n", i, i, r_packet[i]); |
PRINTF("Failed at byte %d. expect %d, received %d\n", i, i, r_packet[i]); |
exit(1); |
} |
} |
163,10 → 163,10
static void receive_one_packet_int(void) |
{ |
int_happend = 0; |
printf("Set BD\n"); |
PRINTF("Set BD\n"); |
eth_bd_base[rx_bindex + 1] = (unsigned long)r_packet; |
|
printf("SetFlags\n"); |
PRINTF("SetFlags\n"); |
SET_FLAG(eth_bd_base[rx_bindex], ETH_RX_BD, IRQ); |
SET_FLAG(eth_bd_base[rx_bindex], ETH_RX_BD, READY); |
SET_FLAG(*eth_moder, ETH_MODER, RXEN); |
174,7 → 174,7
|
int main() |
{ |
printf( "Starting Ethernet test\n" ); |
PRINTF( "Starting Ethernet test\n" ); |
|
tx_bindex = 0; |
rx_bindex = *eth_tx_bd_num; |
197,28 → 197,28
/* interrupt test */ |
excpt_int = (unsigned long)interrupt_handler; |
/* Enable interrup ts */ |
printf("enable ints\n"); |
PRINTF("enable ints\n"); |
mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE); |
mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << ETH_IRQ)); |
|
printf("set mask flags TX\n"); |
PRINTF("set mask flags TX\n"); |
SET_FLAG(*eth_int_mask, ETH_INT_MASK, TXB_M); |
transmit_one_packet_int(); |
tx_bindex += 2; |
printf("waiting for int\n"); |
PRINTF("waiting for int\n"); |
while (!int_happend); |
CLEAR_FLAG(*eth_int_mask, ETH_INT_MASK, TXB_M); |
|
printf("seting mask flag RX\n"); |
PRINTF("seting mask flag RX\n"); |
SET_FLAG(*eth_int_mask, ETH_INT_MASK, RXB_M); |
receive_one_packet_int(); |
rx_bindex += 2; |
printf("waiting for int\n"); |
PRINTF("waiting for int\n"); |
while (!int_happend); |
CLEAR_FLAG(*eth_int_mask, ETH_INT_MASK, RXB_M); |
|
|
printf( "Ending Ethernet test\n" ); |
PRINTF( "Ending Ethernet test\n" ); |
|
report (0xdeaddead); |
exit(0); |
/trunk/or1ksim/testbench/cbasic.c
94,17 → 94,17
for(j = i; j < 35; j++) { |
shl += 1 << j; |
#if 0 |
printf("%u. shl:%.8lx", j, shl); |
PRINTF("%u. shl:%.8lx", j, shl); |
report(shl); |
#endif |
shr += 0x80000000 >> j; |
#if 0 |
printf(" shr:%.8lx", shr); |
PRINTF(" shr:%.8lx", shr); |
report(shr); |
#endif |
bit += ((~j ^ 0x11223344) & 0x33557788) + (j | 0x11223344); |
#if 0 |
printf(" bit:%.8lx\n", bit); |
PRINTF(" bit:%.8lx\n", bit); |
report(bit); |
#endif |
} |
133,14 → 133,14
ul = i; |
sl = i; |
#if 0 |
printf("%u. i:%.8lx ", j, i); |
printf("uc:%.8lx sc:%.8lx ", uc, sc); |
PRINTF("%u. i:%.8lx ", j, i); |
PRINTF("uc:%.8lx sc:%.8lx ", uc, sc); |
report(uc); |
report(sc); |
printf("us:%.8lx ss:%.8lx ", us, ss); |
PRINTF("us:%.8lx ss:%.8lx ", us, ss); |
report(us); |
report(ss); |
printf("ul:%.8lx sl:%.8lx\n", ul, sl); |
PRINTF("ul:%.8lx sl:%.8lx\n", ul, sl); |
report(ul); |
report(sl); |
#endif |
178,7 → 178,7
signed long result3 = 0; |
|
#if DEBUG |
printf("Start...\n"); |
PRINTF("Start...\n"); |
#endif |
result1 = test_cond(1); |
result2 = test_cond(-1); |
185,7 → 185,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_cond: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_cond: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
|
result1 = test_loops(1); |
193,7 → 193,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_loops: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_loops: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
|
result1 = test_arith(1); |
201,7 → 201,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_arith: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_arith: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
|
result1 = test_bitop(1); |
209,7 → 209,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_bitop: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_bitop: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
|
result1 = test_types(1); |
217,7 → 217,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_types: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_types: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
result1 = test_array(1); |
result2 = test_array(-1); |
224,7 → 224,7
result3 -= result1 + result2; |
report(result2); |
#if DEBUG |
printf("After test_array: 0x%.8lx 0x%.8lx\n", result1, result2); |
PRINTF("After test_array: 0x%.8lx 0x%.8lx\n", result1, result2); |
#endif |
|
#ifdef XXX |
231,7 → 231,7
#warning xxx |
#endif |
|
printf("RESULT: %.8lx\n", result3 ^ 0x4bad2569 ^ 0xdeaddead); |
PRINTF("RESULT: %.8lx\n", result3 ^ 0x4bad2569 ^ 0xdeaddead); |
report(result3 ^ 0x4bad2569 ^ 0xdeaddead); |
|
exit(0); |
/trunk/or1ksim/testbench/functest.c
24,7 → 24,7
|
while (c++ < 10) { |
j = fun1(gk, k + 1, k + 2, k + 3, k + 4, k + 5, k + 6); |
printf ("%i\n", gk); |
PRINTF ("%i\n", gk); |
if(j > 40) |
gk = j - 20; |
else |
/trunk/or1ksim/testbench/kbdtest.c
10,7 → 10,7
#define ASSERT(x) ((x)?1: fail (__FUNCTION__, __LINE__)) |
/* Waits a few cycles that uart can prepare its data */ |
#define WAIT() {asm ("l.nop");asm ("l.nop");asm ("l.nop");asm ("l.nop");} |
#define MARK() printf ("Passed line %i\n", __LINE__) |
#define MARK() PRINTF ("Passed line %i\n", __LINE__) |
|
#ifndef __LINE__ |
#define __LINE__ 0 |
36,7 → 36,7
#ifndef __FUNCTION__ |
#define __FUNCTION__ "?" |
#endif |
printf ("Test failed in %s:%i\n", func, line); |
PRINTF ("Test failed in %s:%i\n", func, line); |
report(0xeeeeeeee); |
exit (1); |
} |
54,14 → 54,14
void interrupt_handler () |
{ |
unsigned x; |
printf ("Int\n"); |
PRINTF ("Int\n"); |
do { |
x = getreg (KBD_BASE_ADD); |
if (x) printf ("0x%02x, ", x); |
if (x) PRINTF ("0x%02x, ", x); |
report(x); |
if (x == 1) done = 1; |
#if !INTERACTIVE |
printf ("expecting (0x%02x), ", incoming_scan[current_scan]); |
PRINTF ("expecting (0x%02x), ", incoming_scan[current_scan]); |
if (x) { |
ASSERT (incoming_scan[current_scan++] == x); |
} |
68,7 → 68,7
if ((current_scan + 1) >= sizeof (incoming_scan) / sizeof (char)) done = 1; |
#endif |
} while (x); |
printf ("%i", done); |
PRINTF ("%i", done); |
mtspr(SPR_PICSR, 0); |
} |
|
77,8 → 77,8
/* Use our low priority interrupt handler */ |
excpt_int = (unsigned long)interrupt_handler; |
|
printf ("Reading from keyboard.\n"); |
printf ("Enabling interrupts.\n"); |
PRINTF ("Reading from keyboard.\n"); |
PRINTF ("Enabling interrupts.\n"); |
done = 0; |
|
/* Enable interrupts */ |
85,7 → 85,7
mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE); |
mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << KBD_IRQ)); |
|
while (!done) printf ("[%i]", done); |
while (!done) PRINTF ("[%i]", done); |
report (0xdeaddead); |
return 0; |
} |
/trunk/or1ksim/testbench/mycompress.c
258,7 → 258,7
ratio = 0; |
in_count = 1; |
|
printf("main: bytes_out %d... hsize %d\n", (int)bytes_out, (int)hsize); |
PRINTF("main: bytes_out %d... hsize %d\n", (int)bytes_out, (int)hsize); |
|
checkpoint = CHECK_GAP; |
maxcode = MAXCODE(n_bits = INIT_BITS); |
271,7 → 271,7
for ( fcode = (long) hsize; fcode < 65536L; fcode *= 2L ) |
hshift++; |
hshift = 8 - hshift; /* set hash code range bound */ |
printf("main: hshift %d...\n", hshift); |
PRINTF("main: hshift %d...\n", hshift); |
|
hsize_reg = hsize; |
cl_hash( (count_int) hsize_reg); /* clear hash table */ |
281,13 → 281,13
#else |
while ( (c = getchar()) != EOF ) { |
#endif*/ |
printf("main: bytes_out %d...\n", (int)bytes_out); |
printf("main: hsize_reg %d...\n", (int)hsize_reg); |
printf("main: before compress %d...\n", (int)in_count); |
PRINTF("main: bytes_out %d...\n", (int)bytes_out); |
PRINTF("main: hsize_reg %d...\n", (int)hsize_reg); |
PRINTF("main: before compress %d...\n", (int)in_count); |
while (in_count < BYTES_TO_COMPRESS) { |
c = in_count % 255; |
|
printf("main: compressing %d...\n", (int)in_count); |
PRINTF("main: compressing %d...\n", (int)in_count); |
in_count++; |
fcode = (long) (((long) c << maxbits) + ent); |
i = (((long)c << hshift) ^ ent); /* xor hashing */ |
329,7 → 329,7
/* |
* Put out the final code. |
*/ |
printf("main: output...\n"); |
PRINTF("main: output...\n"); |
output( (code_int)ent ); |
out_count++; |
output( (code_int)-1 ); |
336,7 → 336,7
|
if(bytes_out > in_count) /* exit(2) if no savings */ |
exit_stat = 2; |
printf("main: end...\n"); |
PRINTF("main: end...\n"); |
report (0xdeaddead); |
return 0; |
} |
/trunk/or1ksim/testbench/mc_dram.c
59,7 → 59,7
SET_FIELD(*mc_csc, MC_CSC, BW, mc_sdram_cs[ch].BW); |
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sdram_cs[ch].M); |
SET_FLAG(*mc_csc, MC_CSC, EN); |
printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
} |
} |
|
83,13 → 83,13
mc_sdram_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL); |
mc_cs |= (1 << ch); |
|
printf("get_config(%d) : MS=0x%0lx, BW=0x%0lx, M=0x%0lx\n", ch, |
PRINTF("get_config(%d) : MS=0x%0lx, BW=0x%0lx, M=0x%0lx\n", ch, |
mc_sdram_cs[ch].MS, |
mc_sdram_cs[ch].BW, |
mc_sdram_cs[ch].M); |
} |
} |
printf("get_config() : cs=0x%0x\n", mc_cs); |
PRINTF("get_config() : cs=0x%0x\n", mc_cs); |
return 0; |
} |
|
120,7 → 120,7
|
#ifdef MC_READ_CONF |
if (get_config()) { |
printf("Error reading MC configuration\n"); |
PRINTF("Error reading MC configuration\n"); |
report(0x00000001); |
return(1); |
} |
130,7 → 130,7
|
for (ch=0; ch<8; ch++) { |
if (mc_cs & (0x01 << ch) ) { |
printf ("--- Begin Test on CS%d ---\n", ch); |
PRINTF ("--- Begin Test on CS%d ---\n", ch); |
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); |
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); |
172,7 → 172,7
nRowSh = MC_SDRAM_ROWSH_8; break; |
} |
|
printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lX, rs = %lu, nr = %lu, sh = %lu, sel = %lu\n", |
PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lX, rs = %lu, nr = %lu, sh = %lu, sel = %lu\n", |
*mc_csc, *mc_tms, nRowSize, nRows, nRowSh, mc_sel); |
|
/*nRows -= MC_SDRAM_ROW_OFF;*/ |
283,11 → 283,11
break; |
} /*switch test*/ |
|
printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
|
if (MC_SDRAM_ACC & MC_SDRAM_SROW) { |
/* perform sequential row access */ |
printf("Seuential Row\n"); |
PRINTF("Seuential Row\n"); |
for (j=0; j<T_ROWS; j++) { |
nAddress = mc_sel << 21; |
nAddress |= MC_MEM_BASE; |
297,7 → 297,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); |
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
310,7 → 310,7
|
if (MC_SDRAM_ACC & MC_SDRAM_RROW) { |
/* perform random row access */ |
printf("Random Row\n"); |
PRINTF("Random Row\n"); |
for (j=0; j<T_ROWS; j++) { |
nAddress = mc_sel << 21; |
nAddress |= MC_MEM_BASE; |
320,7 → 320,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); |
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
333,9 → 333,9
|
if (MC_SDRAM_ACC & MC_SDRAM_SGRP) { |
/* perform sequential row in group access */ |
printf("Sequential Group "); |
PRINTF("Sequential Group "); |
|
printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE); |
PRINTF("Group Size = %d\n", MC_SDRAM_GROUPSIZE); |
for (i=0; i<T_GROUPS; i++) { |
nRowGrp = random(nRows - MC_SDRAM_GROUPSIZE) + T_ROW_OFF; |
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) { |
347,7 → 347,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); |
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
361,9 → 361,9
|
if (MC_SDRAM_ACC & MC_SDRAM_RGRP) { |
/* perform random row in group access */ |
printf("Random Group "); |
PRINTF("Random Group "); |
|
printf("Group Size = %d\n", MC_SDRAM_GROUPSIZE); |
PRINTF("Group Size = %d\n", MC_SDRAM_GROUPSIZE); |
for (i=0; i<T_GROUPS; i++) { |
nRowGrp = random(nRows - T_GROUPS) + T_ROW_OFF; |
for (j=0; j<MC_SDRAM_GROUPSIZE; j++) { |
375,7 → 375,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + T_ROW_SIZE, MC_SDRAM_FLAGS); |
|
printf("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
PRINTF("\trow - %lu: nAddress = 0x%08lX, ret = 0x%08lX\n", j, nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
390,7 → 390,7
} /*for test*/ |
} /*if*/ |
} /*for CS*/ |
printf("--- End SDRAM tests ---\n"); |
PRINTF("--- End SDRAM tests ---\n"); |
report(0xDEADDEAD); |
|
gpio_pat ^= 0x00000020; |
/trunk/or1ksim/testbench/acv_uart.c
50,7 → 50,7
/* fails if there is an error */ |
#define NO_ERROR() { unsigned x = getreg (UART_LSR); if ((x & (LSR_BREAK|LSR_FE|LSR_PE|LSR_OE)) && !(x & LSR_ERR)) \ |
printf ("LSR7 (0x%02x) ERR @ %i\n", x, __LINE__); ASSERT(!(x & LSR_ERR) && ((x & 0x60) != 0x40));} |
#define MARK() printf ("Passed line %i\n", __LINE__) |
#define MARK() PRINTF ("Passed line %i\n", __LINE__) |
|
#ifndef __LINE__ |
#define __LINE__ 0 |
61,7 → 61,7
#ifndef __FUNCTION__ |
#define __FUNCTION__ "?" |
#endif |
printf ("Test failed in %s:%i\n", func, line); |
PRINTF ("Test failed in %s:%i\n", func, line); |
report(0xeeeeeeee); |
exit (1); |
} |
84,7 → 84,7
void interrupt_handler () |
{ |
unsigned x; |
printf ("Int\n"); |
PRINTF ("Int\n"); |
report(0xdeaddead); |
report(int_iir = getreg (UART_IIR)); |
report(int_lsr = getreg (UART_LSR)); |
91,23 → 91,23
int_cnt++; |
ASSERT (int_iir != 1); |
switch (int_iir & 0xf) { |
case 0x6: printf ("Receiver LS int.\n"); break; |
case 0x4: printf ("Received Data available. Expecting %02x, received %02x\n", |
case 0x6: PRINTF ("Receiver LS int.\n"); break; |
case 0x4: PRINTF ("Received Data available. Expecting %02x, received %02x\n", |
int_rbr, x = getreg(UART_RBR)); |
ASSERT (x == int_rbr); |
report (x); |
report (int_rbr); |
break; |
case 0xc: printf ("Character timeout. Expecting %02x, received %02x\n", |
case 0xc: PRINTF ("Character timeout. Expecting %02x, received %02x\n", |
int_rbr, x = getreg(UART_RBR)); |
ASSERT (x == int_rbr); |
report (x); |
report (int_rbr); |
break; |
case 0x2: printf ("THR empty.\n"); break; |
case 0x0: printf ("Modem Status.\n"); break; |
case 0x2: PRINTF ("THR empty.\n"); break; |
case 0x0: PRINTF ("Modem Status.\n"); break; |
default: |
printf ("Invalid iir @ %i\n", __LINE__); |
PRINTF ("Invalid iir @ %i\n", __LINE__); |
exit (1); |
} |
mtspr(SPR_PICSR, 0); |
122,10 → 122,10
report (ch); |
/* Wait for rx fifo to be */ |
while (!((x = getreg (UART_LSR)) & LSR_DR)); |
if ((x & (LSR_BREAK|LSR_FE|LSR_PE|LSR_OE)) && !(x & LSR_ERR)) printf ("LSR7 (0x%02x) ERR @ recv_char\n", x); |
if ((x & (LSR_BREAK|LSR_FE|LSR_PE|LSR_OE)) && !(x & LSR_ERR)) PRINTF ("LSR7 (0x%02x) ERR @ recv_char\n", x); |
ASSERT(!(x & LSR_ERR)); |
|
printf ("expected %02x, read %02x\n", ch, r = getreg (UART_RBR)); |
PRINTF ("expected %02x, read %02x\n", ch, r = getreg (UART_RBR)); |
ASSERT (r == ch); /* compare character */ |
} |
|
164,7 → 164,7
|
void register_test () |
{ |
printf ("register test\n"); |
PRINTF ("register test\n"); |
MARK(); |
{ /* test reset values */ |
ASSERT(getreg (UART_RBR) == 0x00); //0 |
301,11 → 301,11
void send_recv_test () |
{ |
char *s; |
printf ("send_recv_test\n"); |
PRINTF ("send_recv_test\n"); |
/* Init */ |
MARK(); |
|
//printf ("basic\n"); |
//PRINTF ("basic\n"); |
ASSERT (!(getreg (UART_LSR) & LSR_DR)); |
MARK(); |
|
348,7 → 348,7
s = "recv"; |
while (*s) recv_char (*s++); |
MARK(); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
/* sends break in both directions */ |
357,7 → 357,7
{ |
unsigned x; |
char *s; |
printf ("break_test\n"); |
PRINTF ("break_test\n"); |
|
MARK(); |
/* Send a break */ |
376,7 → 376,7
MARK(); |
while (!((x = getreg (UART_LSR)) & LSR_DR)); |
/* we should receive zero character with broken frame and break bit should be set */ |
printf("[%x]\n", (LSR_DR | LSR_BREAK | LSR_ERR | LSR_TXFE | LSR_TXE)); |
PRINTF("[%x]\n", (LSR_DR | LSR_BREAK | LSR_ERR | LSR_TXFE | LSR_TXE)); |
ASSERT (x == (LSR_DR | LSR_BREAK | LSR_ERR | LSR_TXFE | LSR_TXE)); |
ASSERT (getreg (UART_RBR) == 0); |
MARK(); |
409,7 → 409,7
while (!((x = getreg (UART_LSR)) & LSR_DR)); |
/* we should receive zero character with broken frame and break bit |
should not be set, because we cleared it */ |
printf("[%x:%x]\n", x, (LSR_DR | LSR_BREAK |LSR_ERR | LSR_TXFE | LSR_TXE)); |
PRINTF("[%x:%x]\n", x, (LSR_DR | LSR_BREAK |LSR_ERR | LSR_TXFE | LSR_TXE)); |
ASSERT (x == (LSR_DR | LSR_BREAK |LSR_ERR | LSR_TXFE | LSR_TXE)); |
ASSERT (getreg (UART_RBR) == 0); |
MARK(); |
417,7 → 417,7
MARK(); |
while (!(getreg (UART_LSR) & LSR_DR)); |
recv_char ('!'); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
/* Tries to send data in different modes in both directions */ |
443,7 → 443,7
void different_modes_test () |
{ |
int speed, parity, length; |
printf ("different modes test\n"); |
PRINTF ("different modes test\n"); |
init_8n1(); |
|
/* Init */ |
499,7 → 499,7
send_char ('T'); |
while (getreg (UART_LSR) != 0x60); /* Wait for THR to be empty */ |
MARK(); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
/* Test various FIFO levels, break and framing error interrupt, etc */ |
507,7 → 507,7
void interrupt_test () |
{ |
int i; |
printf ("interrupt_test\n"); |
PRINTF ("interrupt_test\n"); |
/* Configure UART for interrupt mode */ |
ASSERT(getreg (UART_IIR) == 0xc1); /* nothing should be happening */ |
setreg (UART_LCR, LCR_DIVL); |
699,7 → 699,7
send_char ('T'); |
|
MARK (); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
/* Test if all control bits are set correctly. Lot of this was already tested |
741,7 → 741,7
/* SCR already tested in register_test () */ |
|
MARK (); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
/* Tests parity error and frane error behaviour */ |
748,7 → 748,7
|
void line_error_test () |
{ |
printf ("line_error_test\n"); |
PRINTF ("line_error_test\n"); |
|
/* Test framing error if we change speed */ |
setreg (UART_LCR, LCR_DIVL); |
789,7 → 789,7
#endif |
|
MARK (); |
printf ("OK\n"); |
PRINTF ("OK\n"); |
} |
|
int main () |
814,6 → 814,6
modem_test (); |
modem_error_test ();*/ |
recv_char ('@'); |
printf ("ALL TESTS PASSED\n"); |
PRINTF ("ALL TESTS PASSED\n"); |
return 0; |
} |
/trunk/or1ksim/testbench/mc_ssram.c
50,7 → 50,7
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); |
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_ssram_cs[ch].M); |
SET_FLAG(*mc_csc, MC_CSC, EN); |
printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
} |
} |
|
72,11 → 72,11
mc_ssram_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL); |
mc_cs |= (1 << ch); |
|
printf("get_config(%d) : M=0x%0lx\n", ch, |
PRINTF("get_config(%d) : M=0x%0lx\n", ch, |
mc_ssram_cs[ch].M); |
} |
} |
printf("get_config() : cs=0x%0x\n", mc_cs); |
PRINTF("get_config() : cs=0x%0x\n", mc_cs); |
return 0; |
} |
|
99,7 → 99,7
|
#ifdef MC_READ_CONF |
if (get_config()) { |
printf("Error reading MC configuration\n"); |
PRINTF("Error reading MC configuration\n"); |
report(0x000000001); |
return(1); |
} |
110,13 → 110,13
*rgpio_out = 0; |
for (ch=0; ch<8; ch++) { |
if (mc_cs & (0x01 << ch) ) { |
printf ("--- Begin Test on CS%d ---\n", ch); |
PRINTF ("--- Begin Test on CS%d ---\n", ch); |
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); |
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); |
mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL); |
|
printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
*mc_csc, *mc_tms); |
|
for (test=0; test<4; test++) { |
147,7 → 147,7
break; |
} /*switch test*/ |
|
printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
|
nAddress = mc_sel << 21; |
nAddress |= MC_MEM_BASE; |
157,7 → 157,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + nMemSize, MC_SSRAM_FLAGS); |
|
printf("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
PRINTF("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
169,7 → 169,7
} /*for test*/ |
} /*if*/ |
} /*for CS*/ |
printf("--- End SSRAM tests ---\n"); |
PRINTF("--- End SSRAM tests ---\n"); |
report(0xDEADDEAD); |
|
gpio_pat ^= 0x00000020; |
/trunk/or1ksim/testbench/uos/task.c
16,7 → 16,7
unsigned long count; |
} msg; |
|
printf("Task %d started\n", id); |
PRINTF("Task %d started\n", id); |
|
if(id == 1) { |
msg.id = 1; |
28,9 → 28,9
rc = uos_msgrcv(0, (char *)&msg, sizeof(msg)); |
|
if(rc != 0) { |
printf("Task %d: Waiting for massage\n", id); |
PRINTF("Task %d: Waiting for massage\n", id); |
} else { |
printf("Task %d: Got massage from task %d: 0x%.8x. Sending message to task %d: 0x%.8x \n", id, msg.id, (int)msg.count, (id == 3 ? 1 : (id + 1)), (int)(msg.count + 1)); |
PRINTF("Task %d: Got massage from task %d: 0x%.8x. Sending message to task %d: 0x%.8x \n", id, msg.id, (int)msg.count, (id == 3 ? 1 : (id + 1)), (int)(msg.count + 1)); |
msg.id = id; |
|
if((id == 1) && (msg.count > 15)) { |
/trunk/or1ksim/testbench/uos/uos.c
56,8 → 56,8
void kernel_show_mcbs(struct mcb *mcb) |
{ |
for(;mcb; mcb = mcb->next) { |
printf("MCB len=%u origintask=%u ", mcb->length, mcb->origin); |
printf("msg:%s\n", mcb->msg); |
PRINTF("MCB len=%u origintask=%u ", mcb->length, mcb->origin); |
PRINTF("msg:%s\n", mcb->msg); |
} |
} |
|
68,20 → 68,20
tid_t t; |
|
for(t = 1; t <= MAX_TASKS; t++) { |
printf("\ntask TID=%d: PC=0x%x ", t, (unsigned)tasks[t].regs.pc & ~0x3); |
printf("SP(r1)=0x%x ", (unsigned)tasks[t].regs.sp); |
printf("SR[IEE]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_IEE); |
printf("SR[TEE]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_TEE); |
printf("SR[SM]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_SM); |
PRINTF("\ntask TID=%d: PC=0x%x ", t, (unsigned)tasks[t].regs.pc & ~0x3); |
PRINTF("SP(r1)=0x%x ", (unsigned)tasks[t].regs.sp); |
PRINTF("SR[IEE]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_IEE); |
PRINTF("SR[TEE]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_TEE); |
PRINTF("SR[SM]=%d\n", (unsigned)tasks[t].regs.sr & SPR_SR_SM); |
for(i = 1; i < GPRS; i++) { |
if (i % 4 == 0) |
printf("\n"); |
printf("r%d=0x%.8x ", i, (unsigned)tasks[t].regs.gprs[i]); |
PRINTF("\n"); |
PRINTF("r%d=0x%.8x ", i, (unsigned)tasks[t].regs.gprs[i]); |
} |
printf("\n"); |
PRINTF("\n"); |
kernel_show_mcbs(tasks[t].waiting_msgs); |
} |
printf("\n"); |
PRINTF("\n"); |
} |
|
/* Simple round-robin scheduler that directly calls dispatcher. It is |
94,8 → 94,8
task_context = (unsigned long *)&tasks[curtask].regs; |
|
#if KERNEL_OUTPUT |
printf("kernel_sched(): entry number %d, ", ++kernel_sched_cnt); |
printf("dispatching task TID=%d, time %u cycles", curtask, timestamp()); |
PRINTF("kernel_sched(): entry number %d, ", ++kernel_sched_cnt); |
PRINTF("dispatching task TID=%d, time %u cycles", curtask, timestamp()); |
|
kernel_show_contexts(); |
#endif |
229,8 → 229,8
unsigned short syscall_num; |
|
#if KERNEL_OUTPUT |
printf("kernel_syscall(): entry number %d, ", ++kernel_syscall_cnt); |
printf("current TID=%d, time %u cycles", curtask, timestamp()); |
PRINTF("kernel_syscall(): entry number %d, ", ++kernel_syscall_cnt); |
PRINTF("current TID=%d, time %u cycles", curtask, timestamp()); |
|
kernel_show_contexts(); |
#endif |
244,7 → 244,7
kernel_msgrcv(curtask); |
break; |
default: |
printf("kernel_syscall(): unknown syscall (%u)\n", syscall_num); |
PRINTF("kernel_syscall(): unknown syscall (%u)\n", syscall_num); |
} |
|
#if KERNEL_SYSCALL_SCHED |
260,19 → 260,19
tid_t t; |
int i; |
|
printf("Initializing kernel:\n"); |
PRINTF("Initializing kernel:\n"); |
|
printf(" Clearing kernel structures...\n"); |
PRINTF(" Clearing kernel structures...\n"); |
memset(tasks, 0, sizeof(tasks)); |
memset(stacks, 0, sizeof(stacks)); |
memset(msgs, 0, sizeof(msgs)); |
|
printf(" Initializing MCBs... %d MCB(s)\n", MAX_MSGS); |
PRINTF(" Initializing MCBs... %d MCB(s)\n", MAX_MSGS); |
for(i = 0; i < (MAX_MSGS - 1); i++) |
msgs[i].next = &msgs[i+1]; |
free_mcbs = &msgs[0]; |
|
printf(" Initializing TCBs... %d user task(s)\n", MAX_TASKS); |
PRINTF(" Initializing TCBs... %d user task(s)\n", MAX_TASKS); |
|
tasks_entries(); |
|
295,8 → 295,8
/* Initialize initrrupt controller */ |
int_init(); |
|
printf(" Exceptions will be enabled when first task is dispatched.\n"); |
printf("Kernel initalized. Starting first user task.\n"); |
PRINTF(" Exceptions will be enabled when first task is dispatched.\n"); |
PRINTF("Kernel initalized. Starting first user task.\n"); |
|
#if KERNEL_SYSCALL_SCHED |
kernel_sched(); /* Lets schedule and dispatch our first task */ |
/trunk/or1ksim/testbench/except_test.c
68,7 → 68,7
#define V_TRAP 14 |
|
#if 1 |
#define debug printf |
#define debug PRINTF |
#else |
#define debug |
#endif |
1098,7 → 1098,7
{ |
int ret; |
|
printf("except_test\n"); |
PRINTF("except_test\n"); |
|
/* Register bus error handler */ |
excpt_buserr = (unsigned long)bus_err_handler; |
/trunk/or1ksim/testbench/acv_gpio.c
40,7 → 40,7
|
static void fail (char *file, int line) |
{ |
printf( "Test failed in %s:%i\n", file, line ); |
PRINTF( "Test failed in %s:%i\n", file, line ); |
report( 0xeeeeeeee ); |
exit( 1 ); |
} |
56,7 → 56,7
if ( curr == value ) |
return; |
if ( curr != first ) { |
printf( "While waiting for 0x%08lX, input changed from 0x%08lX to 0x%08lX\n", value, first, curr ); |
PRINTF( "While waiting for 0x%08lX, input changed from 0x%08lX to 0x%08lX\n", value, first, curr ); |
ASSERT( 0 ); |
} |
} |
83,7 → 83,7
|
static void test_registers( void ) |
{ |
printf( "Testing initial values of all registers\n" ); |
PRINTF( "Testing initial values of all registers\n" ); |
ASSERT( *rgpio_oe == 0 ); |
ASSERT( *rgpio_inte == 0 ); |
ASSERT( *rgpio_ptrig == 0 ); |
90,7 → 90,7
ASSERT( *rgpio_ctrl == 0 ); |
ASSERT( *rgpio_ints == 0 ); |
|
printf( "Verifying that RGPIO_IN is read-only\n" ); |
PRINTF( "Verifying that RGPIO_IN is read-only\n" ); |
{ |
unsigned long value = *rgpio_in; |
unsigned i; |
110,7 → 110,7
unsigned i; |
unsigned long oe; |
|
printf( "Testing simple I/O\n" ); |
PRINTF( "Testing simple I/O\n" ); |
for ( i = 1, oe = 1; i < 31; ++ i, oe = (oe << 1) | 1 ) { |
*rgpio_oe = oe; |
|
141,7 → 141,7
{ |
unsigned i; |
|
printf( "Testing interrupts\n" ); |
PRINTF( "Testing interrupts\n" ); |
|
*rgpio_oe = 0x80000000; |
int_count = 0; |
165,7 → 165,7
static void test_external_clock( void ) |
{ |
unsigned i; |
printf( "Testing external clock\n" ); |
PRINTF( "Testing external clock\n" ); |
|
*rgpio_oe = 0x80000000; |
*rgpio_inte = 0x7fffffff; |
200,7 → 200,7
|
static void endshake( void ) |
{ |
printf( "Finishing simulation\n" ); |
PRINTF( "Finishing simulation\n" ); |
*rgpio_oe = 0xffff0000; |
*rgpio_out = 0x12340000; |
wait_input( 0x12345678 ); |
211,7 → 211,7
|
int main() |
{ |
printf( "Starting GPIO test\n" ); |
PRINTF( "Starting GPIO test\n" ); |
|
init_interrupts(); |
|
221,7 → 221,7
test_external_clock(); |
endshake(); |
|
printf( "Ending GPIO test\n" ); |
PRINTF( "Ending GPIO test\n" ); |
|
report (0xdeaddead); |
return 0; |
/trunk/or1ksim/testbench/mc_sync.c
51,7 → 51,7
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_sync_cs[ch].M); |
SET_FIELD(*mc_csc, MC_CSC, BW, 2); |
SET_FLAG(*mc_csc, MC_CSC, EN); |
printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
} |
} |
|
73,11 → 73,11
mc_sync_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL); |
mc_cs |= (1 << ch); |
|
printf("get_config(%d) : M=0x%0lx\n", ch, |
PRINTF("get_config(%d) : M=0x%0lx\n", ch, |
mc_sync_cs[ch].M); |
} |
} |
printf("get_config() : cs=0x%0x\n", mc_cs); |
PRINTF("get_config() : cs=0x%0x\n", mc_cs); |
return 0; |
} |
|
99,7 → 99,7
|
#ifdef MC_READ_CONF |
if (get_config()) { |
printf("Error reading MC configuration.\n"); |
PRINTF("Error reading MC configuration.\n"); |
report(1); |
return(1); |
} |
110,13 → 110,13
*rgpio_out = 0; |
for (ch=0; ch<8; ch++) { |
if (MC_SYNC_CSMASK & (0x01 << ch) ) { |
printf ("--- Begin Test on CS%d ---\n", ch); |
PRINTF ("--- Begin Test on CS%d ---\n", ch); |
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); |
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); |
mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL); |
|
printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
*mc_csc, *mc_tms); |
|
for (test=0; test<4; test++) { |
147,7 → 147,7
break; |
} /*switch test*/ |
|
printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
|
nAddress = mc_sel << 21; |
nAddress |= MC_MEM_BASE; |
157,7 → 157,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + nMemSize, MC_SYNC_FLAGS); |
|
printf("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
PRINTF("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
169,7 → 169,7
} /*for test*/ |
} /*if*/ |
} /*for CS*/ |
printf("--- End SYNC tests ---\n"); |
PRINTF("--- End SYNC tests ---\n"); |
report(0xDEADDEAD); |
|
gpio_pat ^= 0x00000020; |
/trunk/or1ksim/testbench/support/support.h
17,7 → 17,7
#define REG16(add) *((volatile unsigned short *)(add)) |
#define REG32(add) *((volatile unsigned long *)(add)) |
|
void printf(const char *fmt, ...); |
void PRINTF(const char *fmt, ...); |
|
/* For writing into SPR. */ |
void mtspr(unsigned long spr, unsigned long value); |
/trunk/or1ksim/testbench/support/support.c
39,8 → 39,8
while (1); |
} |
|
/* activate printf support in simulator */ |
void printf(const char *fmt, ...) |
/* activate PRINTF support in simulator */ |
void PRINTF(const char *fmt, ...) |
{ |
va_list args; |
va_start(args, fmt); |
95,7 → 95,7
#else |
void report(unsigned long value) |
{ |
printf("report(0x%x);\n", (unsigned) value); |
PRINTF("report(0x%x);\n", (unsigned) value); |
} |
|
/* start_TIMER */ |
/trunk/or1ksim/testbench/mc_async.c
51,7 → 51,7
SET_FIELD(*mc_csc, MC_CSC, SEL, mc_async_cs[ch].M); |
SET_FIELD(*mc_csc, MC_CSC, BW, mc_async_cs[ch].BW); |
SET_FLAG(*mc_csc, MC_CSC, EN); |
printf ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
PRINTF ("Channel Config %d - CSC = 0x%08lX\n", ch, *mc_csc); |
} |
} |
|
74,12 → 74,12
mc_async_cs[ch].M = GET_FIELD(*mc_csc, MC_CSC, SEL); |
mc_cs |= (1 << ch); |
|
printf("get_config(%d) : BW=0x%0lx, M=0x%0lx\n", ch, |
PRINTF("get_config(%d) : BW=0x%0lx, M=0x%0lx\n", ch, |
mc_async_cs[ch].BW, |
mc_async_cs[ch].M); |
} |
} |
printf("get_config() : cs=0x%0x\n", mc_cs); |
PRINTF("get_config() : cs=0x%0x\n", mc_cs); |
return 0; |
} |
|
100,7 → 100,7
*rgpio_out = 0xFFFFFFFF; |
#ifdef MC_READ_CONF |
if (get_config()) { |
printf("Error reading MC configuration.\n"); |
PRINTF("Error reading MC configuration.\n"); |
report(1); |
return(1); |
} |
110,13 → 110,13
|
for (ch=0; ch<8; ch++) { |
if (mc_cs & (0x01 << ch) ) { |
printf ("--- Begin Test on CS%d ---\n", ch); |
PRINTF ("--- Begin Test on CS%d ---\n", ch); |
|
mc_csc = (unsigned long*)(MC_BASE + MC_CSC(ch)); |
mc_tms = (unsigned long*)(MC_BASE + MC_TMS(ch)); |
mc_sel = GET_FIELD(*mc_csc, MC_CSC, SEL); |
|
printf ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
PRINTF ("CS configuration : CSC - 0x%08lX, TMS - 0x%08lXu\n", |
*mc_csc, *mc_tms); |
|
for (test=0; test<4; test++) { |
147,7 → 147,7
break; |
} /*switch test*/ |
|
printf ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
PRINTF ("Begin TEST %lu : CSC - 0x%08lX, TMS - 0x%08lX\n", test, *mc_csc, *mc_tms); |
|
nAddress = mc_sel << 21; |
nAddress |= MC_MEM_BASE; |
157,7 → 157,7
*rgpio_out = gpio_pat; |
ret = mc_test_row(nAddress, nAddress + nMemSize, MC_ASYNC_FLAGS); |
|
printf("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
PRINTF("\trow tested: nAddress = 0x%08lX, ret = 0x%08lX\n", nAddress, ret); |
|
if (ret) { |
gpio_pat ^= 0x00000080; |
169,7 → 169,7
} /*for test*/ |
} /*if*/ |
} /*for CS*/ |
printf("--- End ASYNC tests ---\n"); |
PRINTF("--- End ASYNC tests ---\n"); |
report(0xDEADDEAD); |
|
gpio_pat ^= 0x00000020; |
/trunk/or1ksim/testbench/mul.c
12,14 → 12,14
|
LONGEST acc = 0; |
#define MAC(x,y) {\ |
printf ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));\ |
PRINTF ("[%08x,%08x]\t", (unsigned long)(x), (unsigned long)(y));\ |
acc += (LONGEST)(x) * (LONGEST)(y);\ |
printf ("(%08x,%08x)\n", (unsigned long)(acc >> 32), (unsigned long)(acc & 0xffffffff));\ |
PRINTF ("(%08x,%08x)\n", (unsigned long)(acc >> 32), (unsigned long)(acc & 0xffffffff));\ |
} |
#define MACRC (macrc()) |
static inline long macrc() { |
long result = acc >> 28; |
//printf ("<%08x>\n", (unsigned long)result); |
//PRINTF ("<%08x>\n", (unsigned long)result); |
acc = 0; |
return result; |
} |
44,7 → 44,7
a = t - a * 17; |
b = t + b * 13333; |
|
/*printf ("(%08x,%08x)", a, b);*/ |
/*PRINTF ("(%08x,%08x)", a, b);*/ |
} |
return a; |
} |
63,7 → 63,7
MAC (a, 3); |
MAC (a, 5); |
MAC (a, 7); |
//printf ("(%08x,%08x)", a, b); |
//PRINTF ("(%08x,%08x)", a, b); |
} |
return a; |
} |
85,7 → 85,7
} else { |
a = MACRC; |
} |
// printf ("(%08x,%08x)", a, b); |
// PRINTF ("(%08x,%08x)", a, b); |
} |
return a; |
} |
94,23 → 94,23
unsigned t1; |
unsigned t2; |
unsigned t3; |
printf ("%08x\n", MACRC); |
PRINTF ("%08x\n", MACRC); |
MAC (888888887, 0x87654321); |
printf ("%08x\n", MACRC); |
PRINTF ("%08x\n", MACRC); |
t1 = test_mul (888888887, 0x87654321); |
t2 = test_mac (888888887, 0x87654321); |
t3 = test_mul_mac (888888887, 0x87654321); |
printf ("%08x, expected %08x\n", t1, T1); |
printf ("%08x, expected %08x\n", t2, T2); |
printf ("%08x, expected %08x\n", t3, T3); |
PRINTF ("%08x, expected %08x\n", t1, T1); |
PRINTF ("%08x, expected %08x\n", t2, T2); |
PRINTF ("%08x, expected %08x\n", t3, T3); |
report (t1 ^ t2 ^ t3 ^ T1 ^ T2 ^ T3 ^ 0xdeaddead); |
if (t1 != T1 || t2 != T2 || t3 != T3) { |
printf ("Test failed!\n"); |
PRINTF ("Test failed!\n"); |
if (t1 != T1) exit (1); |
if (t2 != T2) exit (2); |
if (t3 != T3) exit (3); |
} else { |
printf ("Test succesful.\n"); |
PRINTF ("Test succesful.\n"); |
exit (0); |
} |
exit (0); |
/trunk/or1ksim/peripheral/gpio.c
80,15 → 80,15
if ( gpio->baseaddr == 0 ) |
continue; |
|
printf( "\nGPIO %u at 0x%08X:\n", i, gpio->baseaddr ); |
printf( "RGPIO_IN : 0x%08lX\n", gpio->curr.in ); |
printf( "RGPIO_OUT : 0x%08lX\n", gpio->curr.out ); |
printf( "RGPIO_OE : 0x%08lX\n", gpio->curr.oe ); |
printf( "RGPIO_INTE : 0x%08lX\n", gpio->curr.inte ); |
printf( "RGPIO_PTRIG : 0x%08lX\n", gpio->curr.ptrig ); |
printf( "RGPIO_AUX : 0x%08lX\n", gpio->curr.aux ); |
printf( "RGPIO_CTRL : 0x%08lX\n", gpio->curr.ctrl ); |
printf( "RGPIO_INTS : 0x%08lX\n", gpio->curr.ints ); |
PRINTF( "\nGPIO %u at 0x%08X:\n", i, gpio->baseaddr ); |
PRINTF( "RGPIO_IN : 0x%08lX\n", gpio->curr.in ); |
PRINTF( "RGPIO_OUT : 0x%08lX\n", gpio->curr.out ); |
PRINTF( "RGPIO_OE : 0x%08lX\n", gpio->curr.oe ); |
PRINTF( "RGPIO_INTE : 0x%08lX\n", gpio->curr.inte ); |
PRINTF( "RGPIO_PTRIG : 0x%08lX\n", gpio->curr.ptrig ); |
PRINTF( "RGPIO_AUX : 0x%08lX\n", gpio->curr.aux ); |
PRINTF( "RGPIO_CTRL : 0x%08lX\n", gpio->curr.ctrl ); |
PRINTF( "RGPIO_INTS : 0x%08lX\n", gpio->curr.ints ); |
} |
} |
|
/trunk/or1ksim/peripheral/mc.c
141,7 → 141,7
struct dev_memarea *mem_dev = dev_list; |
|
if (config.mc.enabled) { |
printf("Resetting memory controller.\n"); |
PRINTF("Resetting memory controller.\n"); |
memset(&mc, 0, sizeof(struct mc)); |
|
mc.poc = config.mc.POC; |
178,12 → 178,12
{ |
int i; |
|
printf( "\nMemory Controller at 0x%08X:\n", config.mc.baseaddr ); |
printf( "POC: 0x%08X\n", mc.poc ); |
printf( "BAS: 0x%08X\n", mc.ba_mask ); |
printf( "CSR: 0x%08X\n", mc.csr ); |
PRINTF( "\nMemory Controller at 0x%08X:\n", config.mc.baseaddr ); |
PRINTF( "POC: 0x%08X\n", mc.poc ); |
PRINTF( "BAS: 0x%08X\n", mc.ba_mask ); |
PRINTF( "CSR: 0x%08X\n", mc.csr ); |
|
for (i=0; i<N_CE; i++) { |
printf( "CE %02d - CSC: 0x%08X TMS: 0x%08X\n", i, mc.csc[i], mc.tms[i]); |
PRINTF( "CE %02d - CSC: 0x%08X TMS: 0x%08X\n", i, mc.csc[i], mc.tms[i]); |
} |
} |
/trunk/or1ksim/peripheral/eth.c
648,28 → 648,28
if ( eth->baseaddr == 0 ) |
continue; |
|
printf( "\nEthernet MAC %u at 0x%08X:\n", i, eth->baseaddr ); |
printf( "MODER : 0x%08lX\n", eth->regs.moder ); |
printf( "INT_SOURCE : 0x%08lX\n", eth->regs.int_source ); |
printf( "INT_MASK : 0x%08lX\n", eth->regs.int_mask ); |
printf( "IPGT : 0x%08lX\n", eth->regs.ipgt ); |
printf( "IPGR1 : 0x%08lX\n", eth->regs.ipgr1 ); |
printf( "IPGR2 : 0x%08lX\n", eth->regs.ipgr2 ); |
printf( "PACKETLEN : 0x%08lX\n", eth->regs.packetlen ); |
printf( "COLLCONF : 0x%08lX\n", eth->regs.collconf ); |
printf( "TX_BD_NUM : 0x%08lX\n", eth->regs.tx_bd_num ); |
printf( "CTRLMODER : 0x%08lX\n", eth->regs.controlmoder ); |
printf( "MIIMODER : 0x%08lX\n", eth->regs.miimoder ); |
printf( "MIICOMMAND : 0x%08lX\n", eth->regs.miicommand ); |
printf( "MIIADDRESS : 0x%08lX\n", eth->regs.miiaddress ); |
printf( "MIITX_DATA : 0x%08lX\n", eth->regs.miitx_data ); |
printf( "MIIRX_DATA : 0x%08lX\n", eth->regs.miirx_data ); |
printf( "MIISTATUS : 0x%08lX\n", eth->regs.miistatus ); |
printf( "MAC Address : %02X:%02X:%02X:%02X:%02X:%02X\n", |
PRINTF( "\nEthernet MAC %u at 0x%08X:\n", i, eth->baseaddr ); |
PRINTF( "MODER : 0x%08lX\n", eth->regs.moder ); |
PRINTF( "INT_SOURCE : 0x%08lX\n", eth->regs.int_source ); |
PRINTF( "INT_MASK : 0x%08lX\n", eth->regs.int_mask ); |
PRINTF( "IPGT : 0x%08lX\n", eth->regs.ipgt ); |
PRINTF( "IPGR1 : 0x%08lX\n", eth->regs.ipgr1 ); |
PRINTF( "IPGR2 : 0x%08lX\n", eth->regs.ipgr2 ); |
PRINTF( "PACKETLEN : 0x%08lX\n", eth->regs.packetlen ); |
PRINTF( "COLLCONF : 0x%08lX\n", eth->regs.collconf ); |
PRINTF( "TX_BD_NUM : 0x%08lX\n", eth->regs.tx_bd_num ); |
PRINTF( "CTRLMODER : 0x%08lX\n", eth->regs.controlmoder ); |
PRINTF( "MIIMODER : 0x%08lX\n", eth->regs.miimoder ); |
PRINTF( "MIICOMMAND : 0x%08lX\n", eth->regs.miicommand ); |
PRINTF( "MIIADDRESS : 0x%08lX\n", eth->regs.miiaddress ); |
PRINTF( "MIITX_DATA : 0x%08lX\n", eth->regs.miitx_data ); |
PRINTF( "MIIRX_DATA : 0x%08lX\n", eth->regs.miirx_data ); |
PRINTF( "MIISTATUS : 0x%08lX\n", eth->regs.miistatus ); |
PRINTF( "MAC Address : %02X:%02X:%02X:%02X:%02X:%02X\n", |
eth->mac_address[0], eth->mac_address[1], eth->mac_address[2], |
eth->mac_address[3], eth->mac_address[4], eth->mac_address[5] ); |
printf( "HASH0 : 0x%08lX\n", eth->regs.hash0 ); |
printf( "HASH1 : 0x%08lX\n", eth->regs.hash1 ); |
PRINTF( "HASH0 : 0x%08lX\n", eth->regs.hash0 ); |
PRINTF( "HASH1 : 0x%08lX\n", eth->regs.hash1 ); |
} |
} |
/* ========================================================================= */ |
697,7 → 697,7
{ |
struct eth_device *eth; |
if ( !eth_find_controller( addr, ð, &addr ) ) { |
printf( "eth_read32( 0x%08lX ): Not in registered range(s)\n", addr ); |
PRINTF( "eth_read32( 0x%08lX ): Not in registered range(s)\n", addr ); |
return 0; |
} |
|
732,7 → 732,7
if ( (addr >= ETH_BD_BASE) && (addr < ETH_BD_BASE + ETH_BD_SPACE) ) |
return eth->regs.bd_ram[(addr - ETH_BD_BASE) / 4]; |
|
printf( "eth_read32( 0x%08lX ): Illegal address\n", addr + eth->baseaddr ); |
PRINTF( "eth_read32( 0x%08lX ): Illegal address\n", addr + eth->baseaddr ); |
runtime.sim.cont_run = 0; |
return 0; |
} |
746,7 → 746,7
{ |
struct eth_device *eth; |
if ( !eth_find_controller( addr, ð, &addr ) ) { |
printf( "eth_write32( 0x%08lX ): Not in registered range(s)\n", addr ); |
PRINTF( "eth_write32( 0x%08lX ): Not in registered range(s)\n", addr ); |
return; |
} |
|
788,7 → 788,7
return; |
} |
|
printf( "eth_write32( 0x%08lX ): Illegal address\n", addr + eth->baseaddr ); |
PRINTF( "eth_write32( 0x%08lX ): Illegal address\n", addr + eth->baseaddr ); |
runtime.sim.cont_run = 0; |
return; |
} |
/trunk/or1ksim/peripheral/ps2kbd.c
130,7 → 130,7
if (kbd_ccmd == KBD_CCMD_EKI) |
kbd_ccmdbyte &= ~KBD_CCMDBYTE_EN; |
if (config.sim.verbose) |
printf("kbd_write8(%x) %x\n", addr, value); |
PRINTF("kbd_write8(%x) %x\n", addr, value); |
break; |
case KBD_DATA: |
if (kbd_ccmd == KBD_CCMD_WCB) { |
145,7 → 145,7
kbd_kresp = 0x1; |
kbd_ccmd = 0x00; |
if (config.sim.verbose) |
printf("kbd_write8(%x) %x\n", addr, value); |
PRINTF("kbd_write8(%x) %x\n", addr, value); |
break; |
default: |
fprintf (stderr, "Write out of keyboard space (0x%08x)!\n", addr); |
166,7 → 166,7
c |= kbd_ccmdbyte & KBD_CCMDBYTE_SYS; |
c |= KBD_STATUS_INH; |
if (config.sim.verbose) |
printf("kbd_read8(%x) %x\n", addr, c); |
PRINTF("kbd_read8(%x) %x\n", addr, c); |
return c; |
} |
case KBD_DATA: |
181,7 → 181,7
kbd_ccmd = 0x00; |
kbd_kresp = 0x0; |
if (config.sim.verbose) |
printf("kbd_read8(%x) %x\n", addr, rc); |
PRINTF("kbd_read8(%x) %x\n", addr, rc); |
return rc; |
} |
else if (kbd_kresp) { |
201,7 → 201,7
} |
kbd_kcmd = 0x00; |
if (config.sim.verbose) |
printf("kbd_read8(%x) %x\n", addr, rc); |
PRINTF("kbd_read8(%x) %x\n", addr, rc); |
return rc; |
} else if (kbd_buf_count) { |
unsigned long c = kbd_buf[kbd_buf_tail]; |
209,12 → 209,12
kbd_buf_count--; |
kbd_kresp = 0x0; |
if (config.sim.verbose) |
printf("kbd_read8(%x) %x\n", addr, c); |
PRINTF("kbd_read8(%x) %x\n", addr, c); |
return c; |
} |
kbd_kresp = 0x0; |
if (config.sim.verbose) |
printf("kbd_read8(%x) fifo empty\n", addr); |
PRINTF("kbd_read8(%x) fifo empty\n", addr); |
return 0; |
default: |
fprintf (stderr, "Read out of keyboard space (0x%08x)!\n", addr); |
236,7 → 236,7
kbd_int = kbd_kresp || kbd_buf_count; |
kbd_int = kbd_kresp || kbd_buf_count ? kbd_ccmdbyte & KBD_CCMDBYTE_INT : 0; |
if (config.sim.verbose && kbd_int) |
printf("Keyboard Interrupt.... kbd_kresp %x kbd_buf_count %x \n", kbd_kresp, kbd_buf_count); |
PRINTF("Keyboard Interrupt.... kbd_kresp %x kbd_buf_count %x \n", kbd_kresp, kbd_buf_count); |
if (kbd_int) report_interrupt(config.kbd.irq); |
SCHED_ADD(kbd_job, 0, runtime.sim.cycles + kbd_slowdown); |
} |
266,9 → 266,9
|
void kbd_info() |
{ |
printf("kbd_kcmd: %x\n", kbd_kcmd); |
printf("kbd_ccmd: %x\n", kbd_ccmd); |
printf("kbd_ccmdbyte: %x\n", kbd_ccmdbyte); |
printf("kbd_kresp: %x\n", kbd_kresp); |
printf("kbd_buf_count: %x\n", kbd_buf_count); |
PRINTF("kbd_kcmd: %x\n", kbd_kcmd); |
PRINTF("kbd_ccmd: %x\n", kbd_ccmd); |
PRINTF("kbd_ccmdbyte: %x\n", kbd_ccmdbyte); |
PRINTF("kbd_kresp: %x\n", kbd_kresp); |
PRINTF("kbd_buf_count: %x\n", kbd_buf_count); |
} |
/trunk/or1ksim/peripheral/atadevice.c
253,7 → 253,7
|
/* set busy bit */ |
device->regs.status |= ATA_SR_BSY; |
printf("setting status register BSY 0x%2X\n", device->regs.status); |
PRINTF("setting status register BSY 0x%2X\n", device->regs.status); |
|
/* set new state */ |
device->settings.state = ATA_STATE_HW_RST; |
/trunk/or1ksim/peripheral/fb.c
110,7 → 110,7
unsigned short int u16; |
unsigned long int u32; |
|
if (config.sim.verbose) printf ("Creating %s...", filename); |
if (config.sim.verbose) PRINTF ("Creating %s...", filename); |
fo = fopen (filename, "wb+"); |
u16 = CNV16(19778); /* BM */ |
if (!fwrite (&u16, 2, 1, fo)) return 1; |
157,7 → 157,7
if (!fwrite (&val, 4, 1, fo)) return 1; |
} |
|
if (config.sim.verbose) printf ("(%i,%i)", sx, sy); |
if (config.sim.verbose) PRINTF ("(%i,%i)", sx, sy); |
/* Data is stored upside down */ |
for (y = sy - 1; y >= 0; y--) { |
int align = (4 - sx) % 4; |
171,7 → 171,7
if (align && !fwrite (&zero, align, 1, fo)) return 1; |
} |
|
if (config.sim.verbose) printf ("DONE\n"); |
if (config.sim.verbose) PRINTF ("DONE\n"); |
fclose (fo); |
return 0; |
} |
187,7 → 187,7
unsigned short int u16; |
unsigned long int u32; |
|
if (config.sim.verbose) printf ("Creating %s...", filename); |
if (config.sim.verbose) PRINTF ("Creating %s...", filename); |
fo = fopen (filename, "wb+"); |
u16 = CNV16(19778); /* BM */ |
if (!fwrite (&u16, 2, 1, fo)) return 1; |
221,7 → 221,7
u32 = CNV32(0); /* important colours; all are important */ |
if (!fwrite (&u32, 4, 1, fo)) return 1; |
|
if (config.sim.verbose) printf ("(%i,%i)", sx, sy); |
if (config.sim.verbose) PRINTF ("(%i,%i)", sx, sy); |
/* Data is stored upside down */ |
for (y = sy - 1; y >= 0; y--) { |
unsigned char line[FB_SIZEX][3]; |
242,7 → 242,7
if(!fwrite (line, sizeof(line), 1, fo)) return 1; |
} |
|
if (config.sim.verbose) printf ("DONE\n"); |
if (config.sim.verbose) PRINTF ("DONE\n"); |
fclose (fo); |
return 0; |
} |
/trunk/or1ksim/peripheral/dma.c
83,25 → 83,25
if ( dma->baseaddr == 0 ) |
continue; |
|
printf( "\nDMA controller %u at 0x%08X:\n", i, dma->baseaddr ); |
printf( "CSR : 0x%08lX\n", dma->regs.csr ); |
printf( "INT_MSK_A : 0x%08lX\n", dma->regs.int_msk_a ); |
printf( "INT_MSK_B : 0x%08lX\n", dma->regs.int_msk_b ); |
printf( "INT_SRC_A : 0x%08lX\n", dma->regs.int_src_a ); |
printf( "INT_SRC_B : 0x%08lX\n", dma->regs.int_src_b ); |
PRINTF( "\nDMA controller %u at 0x%08X:\n", i, dma->baseaddr ); |
PRINTF( "CSR : 0x%08lX\n", dma->regs.csr ); |
PRINTF( "INT_MSK_A : 0x%08lX\n", dma->regs.int_msk_a ); |
PRINTF( "INT_MSK_B : 0x%08lX\n", dma->regs.int_msk_b ); |
PRINTF( "INT_SRC_A : 0x%08lX\n", dma->regs.int_src_a ); |
PRINTF( "INT_SRC_B : 0x%08lX\n", dma->regs.int_src_b ); |
|
for ( j = 0; j < DMA_NUM_CHANNELS; ++ j ) { |
struct dma_channel *channel = &(dma->ch[j]); |
if ( !channel->referenced ) |
continue; |
printf( "CH%u_CSR : 0x%08lX\n", j, channel->regs.csr ); |
printf( "CH%u_SZ : 0x%08lX\n", j, channel->regs.sz ); |
printf( "CH%u_A0 : 0x%08lX\n", j, channel->regs.a0 ); |
printf( "CH%u_AM0 : 0x%08lX\n", j, channel->regs.am0 ); |
printf( "CH%u_A1 : 0x%08lX\n", j, channel->regs.a1 ); |
printf( "CH%u_AM1 : 0x%08lX\n", j, channel->regs.am1 ); |
printf( "CH%u_DESC : 0x%08lX\n", j, channel->regs.desc ); |
printf( "CH%u_SWPTR : 0x%08lX\n", j, channel->regs.swptr ); |
PRINTF( "CH%u_CSR : 0x%08lX\n", j, channel->regs.csr ); |
PRINTF( "CH%u_SZ : 0x%08lX\n", j, channel->regs.sz ); |
PRINTF( "CH%u_A0 : 0x%08lX\n", j, channel->regs.a0 ); |
PRINTF( "CH%u_AM0 : 0x%08lX\n", j, channel->regs.am0 ); |
PRINTF( "CH%u_A1 : 0x%08lX\n", j, channel->regs.a1 ); |
PRINTF( "CH%u_AM1 : 0x%08lX\n", j, channel->regs.am1 ); |
PRINTF( "CH%u_DESC : 0x%08lX\n", j, channel->regs.desc ); |
PRINTF( "CH%u_SWPTR : 0x%08lX\n", j, channel->regs.swptr ); |
} |
} |
} |
/trunk/or1ksim/peripheral/atahost.c
288,21 → 288,21
if ( ata->baseaddr == 0 ) |
continue; |
|
printf( "\nOCIDEC-%1d %u at: 0x%08X\n", DEV_ID, i, ata->baseaddr ); |
printf( "ATA CTRL : 0x%08lX\n", ata->regs.ctrl ); |
printf( "ATA STAT : 0x%08lx\n", ata->regs.stat ); |
printf( "ATA PCTR : 0x%08lx\n", ata->regs.pctr ); |
PRINTF( "\nOCIDEC-%1d %u at: 0x%08X\n", DEV_ID, i, ata->baseaddr ); |
PRINTF( "ATA CTRL : 0x%08lX\n", ata->regs.ctrl ); |
PRINTF( "ATA STAT : 0x%08lx\n", ata->regs.stat ); |
PRINTF( "ATA PCTR : 0x%08lx\n", ata->regs.pctr ); |
|
#if (DEV_ID > 1) |
printf( "ATA FCTR0 : 0x%08lx\n", ata->regs.pftr0 ); |
printf( "ATA FCTR1 : 0x%08lx\n", ata->regs.pftr1 ); |
PRINTF( "ATA FCTR0 : 0x%08lx\n", ata->regs.pftr0 ); |
PRINTF( "ATA FCTR1 : 0x%08lx\n", ata->regs.pftr1 ); |
#endif |
|
#if (DEV_ID > 2) |
printf( "ATA DTR0 : 0x%08lx\n", ata->regs.dtr0 ); |
printf( "ATA DTR1 : 0x%08lx\n", ata->regs.dtr1 ); |
printf( "ATA TXD : 0x%08lx\n", ata->regs.txb ); |
printf( "ATA RXD : 0x%08lx\n", ata->regs.rxb ); |
PRINTF( "ATA DTR0 : 0x%08lx\n", ata->regs.dtr0 ); |
PRINTF( "ATA DTR1 : 0x%08lx\n", ata->regs.dtr1 ); |
PRINTF( "ATA TXD : 0x%08lx\n", ata->regs.txb ); |
PRINTF( "ATA RXD : 0x%08lx\n", ata->regs.rxb ); |
#endif |
} |
} |
/trunk/or1ksim/peripheral/16450.c
243,7 → 243,7
|
static void send_char (int uart, int bits_send) |
{ |
printf ("'%c'\n", uarts[uart].iregs.txser); |
PRINTF ("'%c'\n", uarts[uart].iregs.txser); |
debug(4, "TX \'%c\' via UART%d...\n", uarts[uart].iregs.txser, uart); |
if (uarts[uart].regs.mcr & UART_MCR_LOOP) |
uarts[uart].iregs.loopback = uarts[uart].iregs.txser; |
304,7 → 304,7
|
debug (4, "lcr vapi %02x, uart %02x\n", uarts[uart].vapi.lcr, uarts[uart].regs.lcr); |
data |= (uarts[uart].vapi.lcr << 8) | (pe << 16) | (fe << 17) | (uarts[uart].vapi.lcr << 8); |
printf ("vapi_send (%08x, %08x)\n", config.uarts[uart].vapi_id, data); |
PRINTF ("vapi_send (%08x, %08x)\n", config.uarts[uart].vapi_id, data); |
debug (4, "vapi_send (%08x, %08x)\n", config.uarts[uart].vapi_id, data); |
vapi_send (config.uarts[uart].vapi_id, data); |
} else { |
400,7 → 400,7
unsigned lsr; |
uarts[i].istat.break_set = 1; |
lsr = UART_LSR_BREAK | UART_LSR_RXERR | UART_LSR_RDRDY; |
printf ("[%x]\n", uarts[i].regs.lsr); |
PRINTF ("[%x]\n", uarts[i].regs.lsr); |
uarts[i].istat.rxser_full = 0; |
uarts[i].istat.rxser_clks = 0; |
uart_add_char (i, lsr << 8); |
555,7 → 555,7
void uart_reset() |
{ |
int i; |
if (config.sim.verbose && config.nuarts) printf("Resetting %u UART(s).\n", config.nuarts); |
if (config.sim.verbose && config.nuarts) PRINTF("Resetting %u UART(s).\n", config.nuarts); |
memset(uarts, 0, sizeof(uarts)); |
|
for(i = 0; i < config.nuarts; i++) { |
576,8 → 576,8
} |
uarts[i].txfs = fopen(config.uarts[i].txfile, "a"); |
if (uarts[i].rxfs && uarts[i].txfs && config.sim.verbose) { |
printf("UART%d at 0x%.8x uses ", i, config.uarts[i].baseaddr); |
printf("%s for RX and %s for TX.\n", config.uarts[i].rxfile, config.uarts[i].txfile); |
PRINTF("UART%d at 0x%.8x uses ", i, config.uarts[i].baseaddr); |
PRINTF("%s for RX and %s for TX.\n", config.uarts[i].rxfile, config.uarts[i].txfile); |
} else |
debug (1, "WARNING: UART%d has problems with TX file stream.\n", i); |
register_memoryarea(config.uarts[i].baseaddr, UART_ADDR_SPACE, 1, 0, uart_read_byte, uart_write_byte); |
599,7 → 599,7
uarts[i].regs.lcr = UART_LCR_RESET; |
uarts[i].vapi.cur_break = uarts[i].vapi.cur_break_cnt = uarts[i].vapi.next_break = 0; |
uarts[i].vapi.next_break_cnt = -1; |
printf ("%i\n", i); |
PRINTF ("%i\n", i); |
SCHED_ADD (uart_clock16, i, runtime.sim.cycles + UART_CLOCK_DIVIDER); |
} |
} |
612,29 → 612,29
for(i = 0; i < config.nuarts; i++) { |
if ( !config.uarts[i].baseaddr ) |
continue; |
printf("\nUART%d visible registers at 0x%.8x:\n", i, config.uarts[i].baseaddr); |
printf("RXBUF:"); |
PRINTF("\nUART%d visible registers at 0x%.8x:\n", i, config.uarts[i].baseaddr); |
PRINTF("RXBUF:"); |
for (j = uarts[i].istat.rxbuf_head; j != uarts[i].istat.rxbuf_tail; j = (j + 1) % uarts[i].fifo_len) |
printf (" %.2x", uarts[i].regs.rxbuf[j]); |
printf(" TXBUF: %.2x\n", uarts[i].regs.txbuf); |
printf("DLL : %.2x DLH : %.2x\n", uarts[i].regs.dll, uarts[i].regs.dlh); |
printf("IER : %.2x IIR : %.2x\n", uarts[i].regs.ier, uarts[i].regs.iir); |
printf("LCR : %.2x MCR : %.2x\n", uarts[i].regs.lcr, uarts[i].regs.mcr); |
printf("LSR : %.2x MSR : %.2x\n", uarts[i].regs.lsr, uarts[i].regs.msr); |
printf("SCR : %.2x\n", uarts[i].regs.scr); |
PRINTF (" %.2x", uarts[i].regs.rxbuf[j]); |
PRINTF(" TXBUF: %.2x\n", uarts[i].regs.txbuf); |
PRINTF("DLL : %.2x DLH : %.2x\n", uarts[i].regs.dll, uarts[i].regs.dlh); |
PRINTF("IER : %.2x IIR : %.2x\n", uarts[i].regs.ier, uarts[i].regs.iir); |
PRINTF("LCR : %.2x MCR : %.2x\n", uarts[i].regs.lcr, uarts[i].regs.mcr); |
PRINTF("LSR : %.2x MSR : %.2x\n", uarts[i].regs.lsr, uarts[i].regs.msr); |
PRINTF("SCR : %.2x\n", uarts[i].regs.scr); |
|
printf("\nInternal registers (sim debug):\n"); |
printf("RXSER: %.2x TXSER: %.2x\n", uarts[i].iregs.rxser, uarts[i].iregs.txser); |
PRINTF("\nInternal registers (sim debug):\n"); |
PRINTF("RXSER: %.2x TXSER: %.2x\n", uarts[i].iregs.rxser, uarts[i].iregs.txser); |
|
printf("\nInternal status (sim debug):\n"); |
printf("char_clks: %d\n", uarts[i].char_clks); |
printf("rxser_clks: %d txser_clks: %d\n", uarts[i].istat.rxser_clks, uarts[i].istat.txser_clks); |
printf("rxser: %d txser: %d\n", uarts[i].istat.rxser_full, uarts[i].istat.txser_full); |
printf("rxbuf: %d txbuf: %d\n", uarts[i].istat.rxbuf_full, uarts[i].istat.txbuf_full); |
printf("Using IRQ%i\n", config.uarts[i].irq); |
PRINTF("\nInternal status (sim debug):\n"); |
PRINTF("char_clks: %d\n", uarts[i].char_clks); |
PRINTF("rxser_clks: %d txser_clks: %d\n", uarts[i].istat.rxser_clks, uarts[i].istat.txser_clks); |
PRINTF("rxser: %d txser: %d\n", uarts[i].istat.rxser_full, uarts[i].istat.txser_full); |
PRINTF("rxbuf: %d txbuf: %d\n", uarts[i].istat.rxbuf_full, uarts[i].istat.txbuf_full); |
PRINTF("Using IRQ%i\n", config.uarts[i].irq); |
if (config.uarts[i].vapi_id) |
printf ("Connected to vapi ID=%x\n\n", config.uarts[i].vapi_id); |
PRINTF ("Connected to vapi ID=%x\n\n", config.uarts[i].vapi_id); |
else |
printf("RX fs: %p TX fs: %p\n\n", uarts[i].rxfs, uarts[i].txfs); |
PRINTF("RX fs: %p TX fs: %p\n\n", uarts[i].rxfs, uarts[i].txfs); |
} |
} |
/trunk/or1ksim/mmu/dmmu.c
112,7 → 112,7
{ |
unsigned long phyaddr = dmmu_simulate_tlb(virtaddr, write_access); |
|
/* printf("DMMU translate(%x) = %x\n", virtaddr, phyaddr);*/ |
/* PRINTF("DMMU translate(%x) = %x\n", virtaddr, phyaddr);*/ |
return phyaddr; |
} |
|
120,12 → 120,12
void dtlb_info() |
{ |
if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) { |
printf("DMMU not implemented. Set UPR[DMP].\n"); |
PRINTF("DMMU not implemented. Set UPR[DMP].\n"); |
return; |
} |
|
printf("Data MMU %dKB: ", config.dmmu.nsets * config.dmmu.entrysize * config.dmmu.nways / 1024); |
printf("%d ways, %d sets, entry size %d bytes\n", config.dmmu.nways, config.dmmu.nsets, config.dmmu.entrysize); |
PRINTF("Data MMU %dKB: ", config.dmmu.nsets * config.dmmu.entrysize * config.dmmu.nways / 1024); |
PRINTF("%d ways, %d sets, entry size %d bytes\n", config.dmmu.nways, config.dmmu.nsets, config.dmmu.entrysize); |
} |
|
/* First check if virtual address is covered by DTLB and if it is: |
148,7 → 148,7
int end_set = config.dmmu.nsets; |
|
if (!testsprbits(SPR_UPR, SPR_UPR_DMP)) { |
printf("DMMU not implemented. Set UPR[DMP].\n"); |
PRINTF("DMMU not implemented. Set UPR[DMP].\n"); |
return; |
} |
|
157,25 → 157,25
else |
start_set = 0; |
|
if (start_set < end_set) printf("\nDMMU: "); |
if (start_set < end_set) PRINTF("\nDMMU: "); |
/* Scan set(s) and way(s). */ |
for (set = start_set; set < end_set; set++) { |
printf("\nSet %x: ", set); |
PRINTF("\nSet %x: ", set); |
for (way = 0; way < config.dmmu.nways; way++) { |
printf(" way %d: ", way); |
printf("vpn=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_VPN)); |
printf("lru=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_LRU)); |
printf("pl1=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_PL1)); |
printf("v=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_V)); |
PRINTF(" way %d: ", way); |
PRINTF("vpn=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_VPN)); |
PRINTF("lru=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_LRU)); |
PRINTF("pl1=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_PL1)); |
PRINTF("v=%x ", getsprbits(SPR_DTLBMR_BASE(way) + set, SPR_DTLBMR_V)); |
|
printf("a=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_A)); |
printf("d=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_D)); |
printf("ure=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_URE)); |
printf("uwe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_UWE)); |
printf("sre=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SRE)); |
printf("swe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SWE)); |
printf("ppn=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_PPN)); |
PRINTF("a=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_A)); |
PRINTF("d=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_D)); |
PRINTF("ure=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_URE)); |
PRINTF("uwe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_UWE)); |
PRINTF("sre=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SRE)); |
PRINTF("swe=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_SWE)); |
PRINTF("ppn=%x ", getsprbits(SPR_DTLBTR_BASE(way) + set, SPR_DTLBTR_PPN)); |
} |
} |
if (start_set < end_set) printf("\n"); |
if (start_set < end_set) PRINTF("\n"); |
} |
/trunk/or1ksim/mmu/immu.c
110,7 → 110,7
{ |
unsigned long phyaddr = immu_simulate_tlb(virtaddr); |
|
/* printf("IMMU translate(%x) = %x\n", virtaddr, phyaddr);*/ |
/* PRINTF("IMMU translate(%x) = %x\n", virtaddr, phyaddr);*/ |
return phyaddr; |
} |
|
117,12 → 117,12
void itlb_info() |
{ |
if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) { |
printf("IMMU not implemented. Set UPR[IMP].\n"); |
PRINTF("IMMU not implemented. Set UPR[IMP].\n"); |
return; |
} |
|
printf("Insn MMU %dKB: ", config.immu.nsets * config.immu.entrysize * config.immu.nways / 1024); |
printf("%d ways, %d sets, entry size %d bytes\n", config.immu.nways, config.immu.nsets, config.immu.entrysize); |
PRINTF("Insn MMU %dKB: ", config.immu.nsets * config.immu.entrysize * config.immu.nways / 1024); |
PRINTF("%d ways, %d sets, entry size %d bytes\n", config.immu.nways, config.immu.nsets, config.immu.entrysize); |
} |
|
/* First check if virtual address is covered by ITLB and if it is: |
145,7 → 145,7
int end_set = config.immu.nsets; |
|
if (!testsprbits(SPR_UPR, SPR_UPR_IMP)) { |
printf("IMMU not implemented. Set UPR[IMP].\n"); |
PRINTF("IMMU not implemented. Set UPR[IMP].\n"); |
return; |
} |
|
154,23 → 154,23
else |
start_set = 0; |
|
if (start_set < end_set) printf("\nIMMU: "); |
if (start_set < end_set) PRINTF("\nIMMU: "); |
/* Scan set(s) and way(s). */ |
for (set = start_set; set < end_set; set++) { |
printf("\nSet %x: ", set); |
PRINTF("\nSet %x: ", set); |
for (way = 0; way < config.immu.nways; way++) { |
printf(" way %d: ", way); |
printf("vpn=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_VPN)); |
printf("lru=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU)); |
printf("pl1=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_PL1)); |
printf("v=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_V)); |
PRINTF(" way %d: ", way); |
PRINTF("vpn=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_VPN)); |
PRINTF("lru=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_LRU)); |
PRINTF("pl1=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_PL1)); |
PRINTF("v=%x ", getsprbits(SPR_ITLBMR_BASE(way) + set, SPR_ITLBMR_V)); |
|
printf("a=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_A)); |
printf("d=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_D)); |
printf("uxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_UXE)); |
printf("sxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_SXE)); |
printf("ppn=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_PPN)); |
PRINTF("a=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_A)); |
PRINTF("d=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_D)); |
PRINTF("uxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_UXE)); |
PRINTF("sxe=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_SXE)); |
PRINTF("ppn=%x ", getsprbits(SPR_ITLBTR_BASE(way) + set, SPR_ITLBTR_PPN)); |
} |
} |
if (start_set < end_set) printf("\n"); |
if (start_set < end_set) PRINTF("\n"); |
} |
/trunk/or1ksim/vapi/vapi.c
369,7 → 369,7
return; |
} |
if(config.sim.verbose) |
printf ("\nConnection with test (id %x) established.\n", id); |
PRINTF ("\nConnection with test (id %x) established.\n", id); |
} |
} |
|
488,7 → 488,7
return 1; |
} |
if (server_fd = get_server_socket("or1ksim", "tcp", runtime.vapi.server_port)) |
printf("VAPI Server started on port %d\n", runtime.vapi.server_port); |
PRINTF("VAPI Server started on port %d\n", runtime.vapi.server_port); |
else { |
perror ("Connection"); |
return 1; |
575,9 → 575,9
numu++; |
if (printout) { |
if ( t->num_ids == 1 ) |
printf (" 0x%x", t->base_id); |
PRINTF (" 0x%x", t->base_id); |
else |
printf (" 0x%x..0x%x", t->base_id, t->base_id + t->num_ids - 1); |
PRINTF (" 0x%x..0x%x", t->base_id, t->base_id + t->num_ids - 1); |
} |
} |
} |
/trunk/or1ksim/bpb/Makefile.in
1,6 → 1,6
# Makefile.in generated automatically by automake 1.4 from Makefile.am |
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am |
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. |
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. |
# This Makefile.in is free software; the Free Software Foundation |
# gives unlimited permission to copy and/or distribute it, |
# with or without modifications, as long as this notice is preserved. |
/trunk/or1ksim/bpb/branch_predict.c
63,12 → 63,12
void bpb_info() |
{ |
if (!config.bpb.enabled) { |
printf("BPB not simulated. Check -bpb option.\n"); |
PRINTF("BPB not simulated. Check -bpb option.\n"); |
return; |
} |
|
printf("BPB %d bytes: ", BPB_LEN * BPB_WAYS * (BPB_PSTATES + BPB_USTATES) / 8); |
printf("%d ways, %d sets, %d bits/prediction\n", BPB_WAYS, BPB_LEN, BPB_PSTATES + BPB_USTATES); |
PRINTF("BPB %d bytes: ", BPB_LEN * BPB_WAYS * (BPB_PSTATES + BPB_USTATES) / 8); |
PRINTF("%d ways, %d sets, %d bits/prediction\n", BPB_WAYS, BPB_LEN, BPB_PSTATES + BPB_USTATES); |
} |
|
/* First check if branch is already in the cache and if it is: |
167,12 → 167,12
void btic_info() |
{ |
if (!config.bpb.btic) { |
printf("BTIC not simulated. Check --btic option.\n"); |
PRINTF("BTIC not simulated. Check --btic option.\n"); |
return; |
} |
|
printf("BTIC %d bytes: ", BTIC_LEN * BTIC_WAYS * (BTIC_USTATES + BTIC_BLOCKSIZE * 8) / 8); |
printf("%d ways, %d sets, %d bits/target\n", BTIC_WAYS, BTIC_LEN, BTIC_USTATES + BTIC_BLOCKSIZE * 8); |
PRINTF("BTIC %d bytes: ", BTIC_LEN * BTIC_WAYS * (BTIC_USTATES + BTIC_BLOCKSIZE * 8) / 8); |
PRINTF("%d ways, %d sets, %d bits/target\n", BTIC_WAYS, BTIC_LEN, BTIC_USTATES + BTIC_BLOCKSIZE * 8); |
} |
|
/* First check if target addr is already in the cache and if it is: |
/trunk/or1ksim/toplevel.c
60,7 → 60,7
#include "atahost.h" |
|
/* CVS revision number. */ |
const char rcsrev[] = "$Revision: 1.90 $"; |
const char rcsrev[] = "$Revision: 1.91 $"; |
|
/* History of execution */ |
int histexec[HISTEXEC_LEN]; |
86,7 → 86,7
va_start(ap, format); |
(void) vsnprintf(p, 1000, format, ap); |
va_end(ap); |
printf("%s", p); |
PRINTF("%s", p); |
fflush(stdout); |
free(p); |
} else { |
96,7 → 96,7
va_start(ap, format); |
(void) vsnprintf(p, 1000, format, ap); |
va_end(ap); |
printf("%s\n", p); |
PRINTF("%s\n", p); |
fflush(stdout); |
free(p); |
#endif |
114,54 → 114,54
|
void version() |
{ |
printf ("\n"); |
printf ("OpenRISC 1000 (OR32) Architectural Simulator, %s\n", rcsrev); |
printf ("Copyright (C) 1999 Damjan Lampret, lampret@opencores.org\n"); |
printf ("Copyright (C) 2000 Damjan Lampret, lampret@opencores.org\n"); |
printf (" Jimmy Chen-Min Chen, jimmy@ee.nctu.edu.tw\n"); |
printf (" Johan Rydberg, johan.rydberg@insight.se\n"); |
printf (" Marko Mlinar, markom@opencores.org\n"); |
printf ("Copyright (C) 2001 Simon Srot, simons@opencores.org\n"); |
printf (" Marko Mlinar, markom@opencores.org\n"); |
printf ("Copyright (C) 2002 Marko Mlinar, markom@opencores.org\n"); |
printf (" Simon Srot, simons@opencores.org\n"); |
printf ("Visit http://www.opencores.org for more information about "); |
printf ("OpenRISC 1000 and\nother open source cores.\n\n"); |
printf ("This software comes with ABSOLUTELY NO WARRANTY; for "); |
printf ("details see COPYING.\nThis is free software, and you "); |
printf ("are welcome to redistribute it under certain\nconditions; "); |
printf ("for details see COPYING.\n"); |
PRINTF ("\n"); |
PRINTF ("OpenRISC 1000 (OR32) Architectural Simulator, %s\n", rcsrev); |
PRINTF ("Copyright (C) 1999 Damjan Lampret, lampret@opencores.org\n"); |
PRINTF ("Copyright (C) 2000 Damjan Lampret, lampret@opencores.org\n"); |
PRINTF (" Jimmy Chen-Min Chen, jimmy@ee.nctu.edu.tw\n"); |
PRINTF (" Johan Rydberg, johan.rydberg@insight.se\n"); |
PRINTF (" Marko Mlinar, markom@opencores.org\n"); |
PRINTF ("Copyright (C) 2001 Simon Srot, simons@opencores.org\n"); |
PRINTF (" Marko Mlinar, markom@opencores.org\n"); |
PRINTF ("Copyright (C) 2002 Marko Mlinar, markom@opencores.org\n"); |
PRINTF (" Simon Srot, simons@opencores.org\n"); |
PRINTF ("Visit http://www.opencores.org for more information about "); |
PRINTF ("OpenRISC 1000 and\nother open source cores.\n\n"); |
PRINTF ("This software comes with ABSOLUTELY NO WARRANTY; for "); |
PRINTF ("details see COPYING.\nThis is free software, and you "); |
PRINTF ("are welcome to redistribute it under certain\nconditions; "); |
PRINTF ("for details see COPYING.\n"); |
} |
|
void |
help() |
{ |
printf("q - quit simulator\n"); |
printf("r - display all registers\n"); |
printf("t - execute next instruction\n"); |
printf("run <instructions> [<hush>] - execute <instruction> instructions, no reg dump if hush\n"); |
printf("pr <r> <value> - patch register <r> with <value>\n"); |
printf("dm <fromaddr> [<toaddr>] - display memory from <fromaddr> to <toaddr>\n"); |
printf("de <fromaddr> [<toaddr>] - debug insn memory\n"); |
printf("pm <addr> <value> - patch memory location <addr> with <value>\n"); |
printf("pc <value> - patch PC register with <value>\n"); |
printf("break <addr> - toggle breakpoint at address <addr>\n"); |
printf("reset - simulator reset\n"); |
printf("hist - execution history\n"); |
printf("stall - stalls the processor and gives control to the debugger\n"); |
printf("stats <num|clear> - execution statistics num or clear it.\n"); |
printf("info - configuration info (caches etc.)\n"); |
printf("dv <fromaddr> [<toaddr>] [<modname>] - dumps memory as verilog (use redirect)\n"); |
printf("dh <fromaddr> [<toaddr>] - dumps memory as hex code (use redirect)\n"); |
printf("<cmd> > <filename> - redirect simulator stdout to <filename> (and not emulated printf)\n"); |
PRINTF("q - quit simulator\n"); |
PRINTF("r - display all registers\n"); |
PRINTF("t - execute next instruction\n"); |
PRINTF("run <instructions> [<hush>] - execute <instruction> instructions, no reg dump if hush\n"); |
PRINTF("pr <r> <value> - patch register <r> with <value>\n"); |
PRINTF("dm <fromaddr> [<toaddr>] - display memory from <fromaddr> to <toaddr>\n"); |
PRINTF("de <fromaddr> [<toaddr>] - debug insn memory\n"); |
PRINTF("pm <addr> <value> - patch memory location <addr> with <value>\n"); |
PRINTF("pc <value> - patch PC register with <value>\n"); |
PRINTF("break <addr> - toggle breakpoint at address <addr>\n"); |
PRINTF("reset - simulator reset\n"); |
PRINTF("hist - execution history\n"); |
PRINTF("stall - stalls the processor and gives control to the debugger\n"); |
PRINTF("stats <num|clear> - execution statistics num or clear it.\n"); |
PRINTF("info - configuration info (caches etc.)\n"); |
PRINTF("dv <fromaddr> [<toaddr>] [<modname>] - dumps memory as verilog (use redirect)\n"); |
PRINTF("dh <fromaddr> [<toaddr>] - dumps memory as hex code (use redirect)\n"); |
PRINTF("<cmd> > <filename> - redirect simulator stdout to <filename> (and not emulated PRINTF)\n"); |
#if !FAST_SIM |
printf("set <section> <item> = <param> - set configuration. See sim.cfg for more information.\n"); |
printf("debug - toggles simulator debug mode\n"); |
PRINTF("set <section> <item> = <param> - set configuration. See sim.cfg for more information.\n"); |
PRINTF("debug - toggles simulator debug mode\n"); |
mp_help (); |
prof_help (); |
printf("cuc - enters Custom Unit Compiler command prompt\n"); |
PRINTF("cuc - enters Custom Unit Compiler command prompt\n"); |
#endif |
printf("help - available commands (this list)\n"); |
PRINTF("help - available commands (this list)\n"); |
} |
|
void debugmem (unsigned long from, unsigned long to ); |
215,16 → 215,16
if (config.sim.exe_log) { |
runtime.sim.fexe_log = fopen(config.sim.exe_log_fn, "wt+"); |
if(!runtime.sim.fexe_log) { |
printf("ERROR: Problems opening exe_log file.\n"); |
PRINTF("ERROR: Problems opening exe_log file.\n"); |
exit (1); |
} |
} |
|
if (config.sim.spr_log) { |
printf("OPENING SPRLOG\n"); |
PRINTF("OPENING SPRLOG\n"); |
runtime.sim.fspr_log = fopen(config.sim.spr_log_fn, "wt+"); |
if (!runtime.sim.fspr_log) { |
printf("ERROR: Problems opening spr_log file.\n"); |
PRINTF("ERROR: Problems opening spr_log file.\n"); |
exit(1); |
} |
} |
240,7 → 240,7
if (config.memory.random_seed == -1) { |
runtime.memory.random_seed = time(NULL); |
/* Print out the seed just in case we ever need to debug */ |
printf("Seeding random generator with value %d\n", config.memory.random_seed); |
PRINTF("Seeding random generator with value %d\n", config.memory.random_seed); |
} else |
runtime.memory.random_seed = config.memory.random_seed; |
srandom(runtime.memory.random_seed); |
303,7 → 303,7
runtime.vapi.enabled = 1; |
vapi_init (); |
if (config.sim.verbose) |
printf ("VAPI started, waiting for clients.\n"); |
PRINTF ("VAPI started, waiting for clients.\n"); |
} |
|
sim_reset (); |
314,17 → 314,17
if (runtime.vapi.enabled) { |
int numu = vapi_num_unconnected (0); |
if (numu) { |
printf ("\nWaiting for VAPI tests with ids:\n"); |
PRINTF ("\nWaiting for VAPI tests with ids:\n"); |
vapi_num_unconnected (1); |
printf ("\n"); |
PRINTF ("\n"); |
while (numu = vapi_num_unconnected (0)) { |
vapi_check (); |
printf ("\rStill waiting for %i VAPI test(s) to connect. ", numu); |
PRINTF ("\rStill waiting for %i VAPI test(s) to connect. ", numu); |
usleep (100); |
} |
printf ("\n"); |
PRINTF ("\n"); |
} |
printf ("All devices connected \n"); |
PRINTF ("All devices connected \n"); |
} |
/* simulator is initialized */ |
runtime.sim.init = 0; |
333,7 → 333,7
/* Display info about various modules */ |
void sim_info () { |
sprs_status(); |
printf ("\n"); |
PRINTF ("\n"); |
memory_table_status (); |
if (config.immu.enabled) itlb_status(-1); |
if (config.dmmu.enabled) dtlb_status(-1); |
396,22 → 396,22
srand(getpid()); |
init_defconfig(); |
if (parse_args(argc, argv)) { |
printf("Usage: %s [options] <filename>\n", argv[0]); |
printf("Options:\n"); |
printf(" -v version and copyright note\n"); |
printf(" -i enable interactive command prompt\n"); |
printf(" --nosrv do not launch JTAG proxy server\n"); /* (CZ) */ |
printf(" --srv <n> launch JTAG proxy server on port <n>; [random]\n"); /* (CZ) */ |
PRINTF("Usage: %s [options] <filename>\n", argv[0]); |
PRINTF("Options:\n"); |
PRINTF(" -v version and copyright note\n"); |
PRINTF(" -i enable interactive command prompt\n"); |
PRINTF(" --nosrv do not launch JTAG proxy server\n"); /* (CZ) */ |
PRINTF(" --srv <n> launch JTAG proxy server on port <n>; [random]\n"); /* (CZ) */ |
#if !FAST_SIM |
printf(" -f or --file load script file [sim.cfg]\n"); |
printf(" --enable-profile enable profiling.\n"); |
printf(" --enable-mprofile enable memory profiling.\n"); |
PRINTF(" -f or --file load script file [sim.cfg]\n"); |
PRINTF(" --enable-profile enable profiling.\n"); |
PRINTF(" --enable-mprofile enable memory profiling.\n"); |
#endif |
printf(" --output-cfg prints C structure of current\n"); |
printf(" configuration to standard output\n"); |
printf("\nor : %s ", argv[0]); |
PRINTF(" --output-cfg prints C structure of current\n"); |
PRINTF(" configuration to standard output\n"); |
PRINTF("\nor : %s ", argv[0]); |
mp_help (); |
printf("\nor : %s ", argv[0]); |
PRINTF("\nor : %s ", argv[0]); |
prof_help (); |
exit(-1); |
} |
432,7 → 432,7
if (!runtime.sim.script_file_specified && config.sim.verbose) |
fprintf (stderr, "WARNING: No config file read, assuming default configuration.\n"); |
#else |
printf ("\n\tNOTE: running fast sim with fixed configuration!\n\n"); |
PRINTF ("\n\tNOTE: running fast sim with fixed configuration!\n\n"); |
#endif |
if (runtime.sim.output_cfg) { |
output_cfg (stdout); |
446,7 → 446,7
if (runtime.sim.iprompt) { |
if (config.debug.gdb_enabled) |
{ |
printf ("(sim) "); |
PRINTF ("(sim) "); |
fflush(stdout); |
HandleServerSocket(true); /* block & check_stdin = true */ |
} |
459,7 → 459,7
linestr = fgets(b2, sizeof b2, stdin); |
#else |
if(!config.debug.gdb_enabled) |
printf ("(sim) "); |
PRINTF ("(sim) "); |
linestr = fgets(b2, sizeof b2, stdin); |
#endif |
} else |
491,7 → 491,8
if (redirstr = strstr(linestr, ">")) { |
*redirstr = '\0'; |
strtoken(&redirstr[1], item1, 1); |
freopen(item1, "w+", stdout); |
runtime.sim.fout = fopen(item1, "w+"); |
if (!runtime.sim.fout) runtime.sim.fout = stdout; |
} |
|
if (linestr[0] == '\n') |
501,7 → 502,7
|
strtoken(linestr, item1, 1); |
if (strcmp(item1, "q") == 0) { /* quit */ |
printf ("\n"); |
PRINTF ("\n"); |
sim_done (); |
} else |
if (strcmp(item1, "help") == 0) /* help */ |
528,7 → 529,7
if (strlen(item3)) |
to = strtoul(item3, NULL, 0); |
dumpmemory(from, to, 0, 1); |
printf("\n"); |
PRINTF("\n"); |
} else |
if (strcmp(item1, "dv") == 0) {/* dump memory as verilog*/ |
char item2[20]; |
552,7 → 553,7
if (!strlen(item4)) |
strcpy(item4, "or1k_mem"); |
dumpverilog(item4, from, to); |
printf("\n"); |
PRINTF("\n"); |
} else |
if (strcmp(item1, "dh") == 0) {/* dump memory as hex*/ |
char item2[20]; |
572,7 → 573,7
if (strlen(item3)) |
to = strtoul(item3, NULL, 0); |
dumphex(from, to); |
printf("\n"); |
PRINTF("\n"); |
} else |
if (strcmp(item1, "pm") == 0) { /* patch memory */ |
char item2[20]; |
630,7 → 631,7
if (strlen(item3)) |
to = strtoul(item3, NULL, 0); |
debugmem(from, to); |
printf("\n"); |
PRINTF("\n"); |
} else |
if (strcmp(item1, "reset") == 0) { /* reset simulator */ |
sim_reset(); |
644,7 → 645,7
int i; |
for(i = HISTEXEC_LEN; i; i--) |
dumpmemory(histexec[i - 1], histexec[i - 1] + 4, 1, 1); |
printf("\n"); |
PRINTF("\n"); |
} else |
if (strcmp(item1, "run") == 0) { /* run */ |
char item2[20]; |
671,7 → 672,7
strtoken(linestr, item2, 2); |
if (strcmp(item2, "clear") == 0) { |
initstats(); |
printf("Cleared.\n"); |
PRINTF("Cleared.\n"); |
} else { |
i = strtoul(item2, NULL, 0); |
printstats(i); |
703,7 → 704,7
set_config_command (s); |
} else |
#endif /* !FAST_SIM */ |
printf("%s: Unknown command.\n", linestr); |
PRINTF("%s: Unknown command.\n", linestr); |
|
{ /* Needed by execution */ |
extern int do_stats; |
752,7 → 753,7
} |
hush = 0; |
fflush(stdout); |
freopen("/dev/fd/0", "w+", stdout); |
runtime.sim.fout = stdout; |
|
if (!runtime.sim.iprompt) /* non-interactive quit */ |
sim_done(); |
856,19 → 857,19
void debugmem( unsigned long from, unsigned long to ) |
{ |
int i; |
printf("starting to dump mem...\n"); |
PRINTF("starting to dump mem...\n"); |
for(i=from; i<to; ) { |
struct label_entry *entry; |
unsigned int _insn; |
printf("i=%x :: ", i); |
PRINTF("i=%x :: ", i); |
|
if (verify_memoryarea(i) && (entry = get_label(i))) |
printf("label: %s |", entry->name); |
PRINTF("label: %s |", entry->name); |
|
iqueue[0].insn = _insn = evalsim_mem32(i); |
iqueue[0].insn_index = insn_decode(_insn); |
disassemble_insn (_insn); |
printf("%08x %s\n", _insn, disassembled); |
PRINTF("%08x %s\n", _insn, disassembled); |
i += insn_len( iqueue[0].insn_index ); |
} |
} |
/trunk/or1ksim/sim-config.c
323,35 → 323,35
{ |
if (config.sim.verbose) { |
char temp[20]; |
printf("Verbose on, "); |
PRINTF("Verbose on, "); |
if (config.sim.debug) |
printf("simdebug on, "); |
PRINTF("simdebug on, "); |
else |
printf("simdebug off, "); |
PRINTF("simdebug off, "); |
if (runtime.sim.iprompt) |
printf("interactive prompt on\n"); |
PRINTF("interactive prompt on\n"); |
else |
printf("interactive prompt off\n"); |
PRINTF("interactive prompt off\n"); |
|
printf("Machine initialization...\n"); |
PRINTF("Machine initialization...\n"); |
generate_time_pretty (temp, config.sim.clkcycle_ps); |
printf("Clock cycle: %s\n", temp); |
PRINTF("Clock cycle: %s\n", temp); |
if (testsprbits(SPR_UPR, SPR_UPR_DCP)) |
printf("Data cache present.\n"); |
PRINTF("Data cache present.\n"); |
else |
printf("No data cache.\n"); |
PRINTF("No data cache.\n"); |
if (testsprbits(SPR_UPR, SPR_UPR_ICP)) |
printf("Insn cache tag present.\n"); |
PRINTF("Insn cache tag present.\n"); |
else |
printf("No instruction cache.\n"); |
PRINTF("No instruction cache.\n"); |
if (config.bpb.enabled) |
printf("BPB simulation on.\n"); |
PRINTF("BPB simulation on.\n"); |
else |
printf("BPB simulation off.\n"); |
PRINTF("BPB simulation off.\n"); |
if (config.bpb.btic) |
printf("BTIC simulation on.\n"); |
PRINTF("BTIC simulation on.\n"); |
else |
printf("BTIC simulation off.\n"); |
PRINTF("BTIC simulation off.\n"); |
} |
} |
|
1319,7 → 1319,7
int nparam; |
int rd, wd; |
if (config.sim.verbose && !runtime.sim.output_cfg) |
printf ("Reading script file from '%s'...\n", local ? filename : ctmp); |
PRINTF ("Reading script file from '%s'...\n", local ? filename : ctmp); |
strcpy (runtime.sim.script_fn, local ? filename : ctmp); |
|
while (!feof(f)) { |
1396,11 → 1396,11
int noparams = 0, i, noitem = 0; |
while (*s && isspace (*s)) s++; |
sec = s; |
printf ("s:%s\n", s); |
PRINTF ("s:%s\n", s); |
while (*s && *s != ' ') s++; |
if (!(*s)) noitem = 1; |
*s = 0; |
printf ("sec:%s\n", sec); |
PRINTF ("sec:%s\n", sec); |
section = 0; |
for (i = 1; i < sizeof(sections) / sizeof(struct section); i++) |
if (strcmp (sections[i].name, sec) == 0) { |
1420,8 → 1420,8
} else |
params = s + 1; |
*s = 0; |
printf ("item:%s\n", item); |
printf ("params:%s\n", params); |
PRINTF ("item:%s\n", item); |
PRINTF ("params:%s\n", params); |
{ |
int i, found = -1; |
for (i = 0; i < sizeof(config_params)/sizeof(struct config_params); i++) |
1447,20 → 1447,20
int i; |
switch (set_config (s)) { |
case 1: |
printf ("Invalid or missing section name. One of valid sections must be specified:\n"); |
PRINTF ("Invalid or missing section name. One of valid sections must be specified:\n"); |
for (i = 1; i < sizeof(sections) / sizeof(struct section); i++) |
printf ("%s ", sections[i].name); |
printf ("\n"); |
PRINTF ("%s ", sections[i].name); |
PRINTF ("\n"); |
break; |
case 2: |
printf ("Invalid or missing item name. One of valid items must be specified:\n"); |
PRINTF ("Invalid or missing item name. One of valid items must be specified:\n"); |
for (i = 0; i < sizeof(config_params)/sizeof(struct config_params); i++) |
if (config_params[i].section == section) |
printf ("%s ", config_params[i].name); |
printf ("\n"); |
PRINTF ("%s ", config_params[i].name); |
PRINTF ("\n"); |
break; |
case 3: |
printf ("Invalid parameters specified.\n"); |
PRINTF ("Invalid parameters specified.\n"); |
break; |
} |
} |
/trunk/or1ksim/support/sched.h
55,7 → 55,7
#define SCHED_PRINT_JOBS() {\ |
int i;\ |
for (i = 1; i < scheduler.size; i++) \ |
printf ("\t%i: %x $%i @ %i\n", i, scheduler.heap[i].func, scheduler.heap[i].param, scheduler.heap[i].time);\ |
PRINTF ("\t%i: %x $%i @ %i\n", i, scheduler.heap[i].func, scheduler.heap[i].param, scheduler.heap[i].time);\ |
} |
#else |
#define SCHED_PRINT_JOBS() |
64,9 → 64,9
/* Adds new job to the queue */ |
#define SCHED_ADD(job_func, job_param, job_time) {\ |
int ___i;\ |
if (SCHED_DEBUG > 0) printf ("%s@%i:SCHED_ADD(func %x, param %i, time %i)\n", __FUNCTION__, runtime.sim.cycles, (job_func), (job_param), (job_time));\ |
if (SCHED_DEBUG > 0) PRINTF ("%s@%i:SCHED_ADD(func %x, param %i, time %i)\n", __FUNCTION__, runtime.sim.cycles, (job_func), (job_param), (job_time));\ |
SCHED_PRINT_JOBS();\ |
if (SCHED_DEBUG > 1) printf ("--------\n");\ |
if (SCHED_DEBUG > 1) PRINTF ("--------\n");\ |
___i = scheduler.size++;\ |
while (___i > 1 && scheduler.heap[___i / 2].time > (job_time)) scheduler.heap[___i] = scheduler.heap[___i /= 2];\ |
scheduler.heap[___i].func = (job_func);\ |
79,9 → 79,9
#define SCHED_REMOVE_ITEM(index) {\ |
struct sched_entry *tmp;\ |
int ___i = (index), ___j;\ |
if (SCHED_DEBUG > 0) printf ("%s@%i:SCHED_REMOVE%i(time %i)\n", __FUNCTION__, runtime.sim.cycles, (index), scheduler.heap[___i].time); \ |
if (SCHED_DEBUG > 0) PRINTF ("%s@%i:SCHED_REMOVE%i(time %i)\n", __FUNCTION__, runtime.sim.cycles, (index), scheduler.heap[___i].time); \ |
SCHED_PRINT_JOBS();\ |
if (SCHED_DEBUG > 1) printf ("--------\n");\ |
if (SCHED_DEBUG > 1) PRINTF ("--------\n");\ |
tmp = &scheduler.heap[--scheduler.size];\ |
while (___i <= scheduler.size / 2) {\ |
___j = 2 * ___i;\ |
/trunk/or1ksim/support/simprintf.c
19,7 → 19,7
|
/* Debugger LIBC functions. Working, but VERY, VERY ugly written. |
I wrote following code when basic simulator started to work and I was |
desperate to use some printfs in my debugged code. And it was |
desperate to use some PRINTFs in my debugged code. And it was |
also used to get some output from Dhrystone MIPS benchmark. */ |
|
#include <stdio.h> |
31,7 → 31,7
#include <arch.h> |
#include "sim-config.h" |
|
/* Length of printf format string */ |
/* Length of PRINTF format string */ |
#define FMTLEN 2000 |
|
char fmtstr[FMTLEN]; |
/trunk/or1ksim/support/dumpverilog.c
47,8 → 47,8
struct label_entry *tmp; |
char dis[DISWIDTH + 100]; |
struct mem_entry *entry; |
printf("// This file was generated by or1ksim %s\n", rcsrev); |
printf(OR1K_MEM_VERILOG_HEADER(verilog_modname, from/DWQ, to/DWQ, (DISWIDTH*8))); |
PRINTF("// This file was generated by or1ksim %s\n", rcsrev); |
PRINTF(OR1K_MEM_VERILOG_HEADER(verilog_modname, from/DWQ, to/DWQ, (DISWIDTH*8))); |
|
for(i = from; i < to; i++) |
{ |
58,9 → 58,9
{ |
if (verify_memoryarea(i) && (tmp = get_label(i))) |
if (tmp) |
printf("\n//\t%s%s", tmp->name, LABELEND_CHAR); |
PRINTF("\n//\t%s%s", tmp->name, LABELEND_CHAR); |
|
printf("\n\tmem['h%x] = %d'h%.8lx;", i/DWQ, DW, evalsim_mem32(i)); |
PRINTF("\n\tmem['h%x] = %d'h%.8lx;", i/DWQ, DW, evalsim_mem32(i)); |
|
disassemble_insn (_insn); |
strcpy (dis, disassembled); |
68,14 → 68,14
if (strlen(dis) < DISWIDTH) |
memset(dis + strlen(dis), ' ', DISWIDTH); |
dis[DISWIDTH] = '\0'; |
printf("\n\tdis['h%x] = {\"%s\"};", i/DWQ, dis); |
PRINTF("\n\tdis['h%x] = {\"%s\"};", i/DWQ, dis); |
dis[0] = '\0'; |
i += insn_len(index) - 1; |
} else { |
if (i % 64 == 0) |
printf("\n"); |
PRINTF("\n"); |
|
printf("\n\tmem['h%x] = 'h%.2x;", i/DWQ, evalsim_mem8(i)); |
PRINTF("\n\tmem['h%x] = 'h%.2x;", i/DWQ, evalsim_mem8(i)); |
} |
done = 1; |
} |
82,7 → 82,7
|
if (done) |
{ |
printf(OR1K_MEM_VERILOG_FOOTER); |
PRINTF(OR1K_MEM_VERILOG_FOOTER); |
return; |
} |
|
91,15 → 91,15
for(i = from; i < to; i++) |
{ |
if (i % 8 == 0) |
printf("\n%.8x: ", i); |
PRINTF("\n%.8x: ", i); |
|
/* don't print ascii chars below 0x20. */ |
if (evalsim_mem32(i) < 0x20) |
printf("0x%.2x ", (unsigned char)evalsim_mem32(i)); |
PRINTF("0x%.2x ", (unsigned char)evalsim_mem32(i)); |
else |
printf("0x%.2x'%c' ", (unsigned char)evalsim_mem32(i), (unsigned char)evalsim_mem32(i)); |
PRINTF("0x%.2x'%c' ", (unsigned char)evalsim_mem32(i), (unsigned char)evalsim_mem32(i)); |
} |
printf(OR1K_MEM_VERILOG_FOOTER); |
PRINTF(OR1K_MEM_VERILOG_FOOTER); |
} |
|
void dumphex(unsigned int from, unsigned int to) |
111,11 → 111,11
int index = insn_decode(_insn); |
if (index >= 0) |
{ |
printf("%.8lx\n", evalsim_mem32(i)); |
PRINTF("%.8lx\n", evalsim_mem32(i)); |
|
i += insn_len(index) - 1; |
} |
else |
printf("%.2x\n", evalsim_mem8(i)); |
PRINTF("%.2x\n", evalsim_mem8(i)); |
} |
} |