New directory structure:

- simulator source now in 'src' subdirectory
- imported files from 'ext' repository
- support building in arbitrary places, including
outside of the source tree.  See comment at top
of SConstruct file for more details.
Regression tests are temporarily disabled; that
syetem needs more extensive revisions.

SConstruct:
    Update for new directory structure.
    Modify to support build trees that are not subdirectories
    of the source tree.  See comment at top of file for
    more details.
    Regression tests are temporarily disabled.
src/arch/SConscript:
src/arch/isa_parser.py:
src/python/SConscript:
    Update for new directory structure.

--HG--
rename : build/SConstruct => SConstruct
rename : build/default_options/ALPHA_FS => build_opts/ALPHA_FS
rename : build/default_options/ALPHA_FS_TL => build_opts/ALPHA_FS_TL
rename : build/default_options/ALPHA_SE => build_opts/ALPHA_SE
rename : build/default_options/MIPS_SE => build_opts/MIPS_SE
rename : build/default_options/SPARC_SE => build_opts/SPARC_SE
rename : Doxyfile => src/Doxyfile
rename : SConscript => src/SConscript
rename : arch/SConscript => src/arch/SConscript
rename : arch/alpha/SConscript => src/arch/alpha/SConscript
rename : arch/alpha/aout_machdep.h => src/arch/alpha/aout_machdep.h
rename : arch/alpha/arguments.cc => src/arch/alpha/arguments.cc
rename : arch/alpha/arguments.hh => src/arch/alpha/arguments.hh
rename : arch/alpha/ecoff_machdep.h => src/arch/alpha/ecoff_machdep.h
rename : arch/alpha/ev5.cc => src/arch/alpha/ev5.cc
rename : arch/alpha/ev5.hh => src/arch/alpha/ev5.hh
rename : arch/alpha/faults.cc => src/arch/alpha/faults.cc
rename : arch/alpha/faults.hh => src/arch/alpha/faults.hh
rename : arch/alpha/freebsd/system.cc => src/arch/alpha/freebsd/system.cc
rename : arch/alpha/freebsd/system.hh => src/arch/alpha/freebsd/system.hh
rename : arch/alpha/isa/branch.isa => src/arch/alpha/isa/branch.isa
rename : arch/alpha/isa/decoder.isa => src/arch/alpha/isa/decoder.isa
rename : arch/alpha/isa/fp.isa => src/arch/alpha/isa/fp.isa
rename : arch/alpha/isa/int.isa => src/arch/alpha/isa/int.isa
rename : arch/alpha/isa/main.isa => src/arch/alpha/isa/main.isa
rename : arch/alpha/isa/mem.isa => src/arch/alpha/isa/mem.isa
rename : arch/alpha/isa/opcdec.isa => src/arch/alpha/isa/opcdec.isa
rename : arch/alpha/isa/pal.isa => src/arch/alpha/isa/pal.isa
rename : arch/alpha/isa/unimp.isa => src/arch/alpha/isa/unimp.isa
rename : arch/alpha/isa/unknown.isa => src/arch/alpha/isa/unknown.isa
rename : arch/alpha/isa/util.isa => src/arch/alpha/isa/util.isa
rename : arch/alpha/isa_traits.hh => src/arch/alpha/isa_traits.hh
rename : arch/alpha/linux/aligned.hh => src/arch/alpha/linux/aligned.hh
rename : arch/alpha/linux/hwrpb.hh => src/arch/alpha/linux/hwrpb.hh
rename : arch/alpha/linux/linux.cc => src/arch/alpha/linux/linux.cc
rename : arch/alpha/linux/linux.hh => src/arch/alpha/linux/linux.hh
rename : arch/alpha/linux/process.cc => src/arch/alpha/linux/process.cc
rename : arch/alpha/linux/process.hh => src/arch/alpha/linux/process.hh
rename : arch/alpha/linux/system.cc => src/arch/alpha/linux/system.cc
rename : arch/alpha/linux/system.hh => src/arch/alpha/linux/system.hh
rename : arch/alpha/linux/thread_info.hh => src/arch/alpha/linux/thread_info.hh
rename : arch/alpha/linux/threadinfo.hh => src/arch/alpha/linux/threadinfo.hh
rename : arch/alpha/osfpal.cc => src/arch/alpha/osfpal.cc
rename : arch/alpha/osfpal.hh => src/arch/alpha/osfpal.hh
rename : arch/alpha/process.cc => src/arch/alpha/process.cc
rename : arch/alpha/process.hh => src/arch/alpha/process.hh
rename : arch/alpha/regfile.hh => src/arch/alpha/regfile.hh
rename : arch/alpha/stacktrace.cc => src/arch/alpha/stacktrace.cc
rename : arch/alpha/stacktrace.hh => src/arch/alpha/stacktrace.hh
rename : arch/alpha/system.cc => src/arch/alpha/system.cc
rename : arch/alpha/system.hh => src/arch/alpha/system.hh
rename : arch/alpha/tlb.cc => src/arch/alpha/tlb.cc
rename : arch/alpha/tlb.hh => src/arch/alpha/tlb.hh
rename : arch/alpha/tru64/process.cc => src/arch/alpha/tru64/process.cc
rename : arch/alpha/tru64/process.hh => src/arch/alpha/tru64/process.hh
rename : arch/alpha/tru64/system.cc => src/arch/alpha/tru64/system.cc
rename : arch/alpha/tru64/system.hh => src/arch/alpha/tru64/system.hh
rename : arch/alpha/tru64/tru64.cc => src/arch/alpha/tru64/tru64.cc
rename : arch/alpha/tru64/tru64.hh => src/arch/alpha/tru64/tru64.hh
rename : arch/alpha/types.hh => src/arch/alpha/types.hh
rename : arch/alpha/utility.hh => src/arch/alpha/utility.hh
rename : arch/alpha/vtophys.cc => src/arch/alpha/vtophys.cc
rename : arch/alpha/vtophys.hh => src/arch/alpha/vtophys.hh
rename : arch/isa_parser.py => src/arch/isa_parser.py
rename : arch/isa_specific.hh => src/arch/isa_specific.hh
rename : arch/mips/SConscript => src/arch/mips/SConscript
rename : arch/mips/faults.cc => src/arch/mips/faults.cc
rename : arch/mips/faults.hh => src/arch/mips/faults.hh
rename : arch/mips/isa/base.isa => src/arch/mips/isa/base.isa
rename : arch/mips/isa/bitfields.isa => src/arch/mips/isa/bitfields.isa
rename : arch/mips/isa/decoder.isa => src/arch/mips/isa/decoder.isa
rename : arch/mips/isa/formats/basic.isa => src/arch/mips/isa/formats/basic.isa
rename : arch/mips/isa/formats/branch.isa => src/arch/mips/isa/formats/branch.isa
rename : arch/mips/isa/formats/formats.isa => src/arch/mips/isa/formats/formats.isa
rename : arch/mips/isa/formats/fp.isa => src/arch/mips/isa/formats/fp.isa
rename : arch/mips/isa/formats/int.isa => src/arch/mips/isa/formats/int.isa
rename : arch/mips/isa/formats/mem.isa => src/arch/mips/isa/formats/mem.isa
rename : arch/mips/isa/formats/noop.isa => src/arch/mips/isa/formats/noop.isa
rename : arch/mips/isa/formats/tlbop.isa => src/arch/mips/isa/formats/tlbop.isa
rename : arch/mips/isa/formats/trap.isa => src/arch/mips/isa/formats/trap.isa
rename : arch/mips/isa/formats/unimp.isa => src/arch/mips/isa/formats/unimp.isa
rename : arch/mips/isa/formats/unknown.isa => src/arch/mips/isa/formats/unknown.isa
rename : arch/mips/isa/formats/util.isa => src/arch/mips/isa/formats/util.isa
rename : arch/mips/isa/includes.isa => src/arch/mips/isa/includes.isa
rename : arch/mips/isa/main.isa => src/arch/mips/isa/main.isa
rename : arch/mips/isa/operands.isa => src/arch/mips/isa/operands.isa
rename : arch/mips/isa_traits.cc => src/arch/mips/isa_traits.cc
rename : arch/mips/isa_traits.hh => src/arch/mips/isa_traits.hh
rename : arch/mips/linux/linux.cc => src/arch/mips/linux/linux.cc
rename : arch/mips/linux/linux.hh => src/arch/mips/linux/linux.hh
rename : arch/mips/linux/process.cc => src/arch/mips/linux/process.cc
rename : arch/mips/linux/process.hh => src/arch/mips/linux/process.hh
rename : arch/mips/process.cc => src/arch/mips/process.cc
rename : arch/mips/process.hh => src/arch/mips/process.hh
rename : arch/mips/regfile/float_regfile.hh => src/arch/mips/regfile/float_regfile.hh
rename : arch/mips/regfile/int_regfile.hh => src/arch/mips/regfile/int_regfile.hh
rename : arch/mips/regfile/misc_regfile.hh => src/arch/mips/regfile/misc_regfile.hh
rename : arch/mips/regfile/regfile.hh => src/arch/mips/regfile/regfile.hh
rename : arch/mips/stacktrace.hh => src/arch/mips/stacktrace.hh
rename : arch/mips/types.hh => src/arch/mips/types.hh
rename : arch/mips/utility.hh => src/arch/mips/utility.hh
rename : arch/sparc/SConscript => src/arch/sparc/SConscript
rename : arch/sparc/faults.cc => src/arch/sparc/faults.cc
rename : arch/sparc/faults.hh => src/arch/sparc/faults.hh
rename : arch/sparc/isa/base.isa => src/arch/sparc/isa/base.isa
rename : arch/sparc/isa/bitfields.isa => src/arch/sparc/isa/bitfields.isa
rename : arch/sparc/isa/decoder.isa => src/arch/sparc/isa/decoder.isa
rename : arch/sparc/isa/formats.isa => src/arch/sparc/isa/formats.isa
rename : arch/sparc/isa/formats/basic.isa => src/arch/sparc/isa/formats/basic.isa
rename : arch/sparc/isa/formats/branch.isa => src/arch/sparc/isa/formats/branch.isa
rename : arch/sparc/isa/formats/integerop.isa => src/arch/sparc/isa/formats/integerop.isa
rename : arch/sparc/isa/formats/mem.isa => src/arch/sparc/isa/formats/mem.isa
rename : arch/sparc/isa/formats/nop.isa => src/arch/sparc/isa/formats/nop.isa
rename : arch/sparc/isa/formats/priv.isa => src/arch/sparc/isa/formats/priv.isa
rename : arch/sparc/isa/formats/trap.isa => src/arch/sparc/isa/formats/trap.isa
rename : arch/sparc/isa/formats/unknown.isa => src/arch/sparc/isa/formats/unknown.isa
rename : arch/sparc/isa/includes.isa => src/arch/sparc/isa/includes.isa
rename : arch/sparc/isa/main.isa => src/arch/sparc/isa/main.isa
rename : arch/sparc/isa/operands.isa => src/arch/sparc/isa/operands.isa
rename : arch/sparc/isa_traits.hh => src/arch/sparc/isa_traits.hh
rename : arch/sparc/linux/linux.cc => src/arch/sparc/linux/linux.cc
rename : arch/sparc/linux/linux.hh => src/arch/sparc/linux/linux.hh
rename : arch/sparc/linux/process.cc => src/arch/sparc/linux/process.cc
rename : arch/sparc/linux/process.hh => src/arch/sparc/linux/process.hh
rename : arch/sparc/process.cc => src/arch/sparc/process.cc
rename : arch/sparc/process.hh => src/arch/sparc/process.hh
rename : arch/sparc/regfile.hh => src/arch/sparc/regfile.hh
rename : arch/sparc/solaris/process.cc => src/arch/sparc/solaris/process.cc
rename : arch/sparc/solaris/process.hh => src/arch/sparc/solaris/process.hh
rename : arch/sparc/solaris/solaris.cc => src/arch/sparc/solaris/solaris.cc
rename : arch/sparc/solaris/solaris.hh => src/arch/sparc/solaris/solaris.hh
rename : arch/sparc/stacktrace.hh => src/arch/sparc/stacktrace.hh
rename : arch/sparc/system.cc => src/arch/sparc/system.cc
rename : arch/sparc/system.hh => src/arch/sparc/system.hh
rename : arch/sparc/utility.hh => src/arch/sparc/utility.hh
rename : base/bitfield.hh => src/base/bitfield.hh
rename : base/callback.hh => src/base/callback.hh
rename : base/chunk_generator.hh => src/base/chunk_generator.hh
rename : base/circlebuf.cc => src/base/circlebuf.cc
rename : base/circlebuf.hh => src/base/circlebuf.hh
rename : base/compression/lzss_compression.cc => src/base/compression/lzss_compression.cc
rename : base/compression/lzss_compression.hh => src/base/compression/lzss_compression.hh
rename : base/compression/null_compression.hh => src/base/compression/null_compression.hh
rename : base/cprintf.cc => src/base/cprintf.cc
rename : base/cprintf.hh => src/base/cprintf.hh
rename : base/cprintf_formats.hh => src/base/cprintf_formats.hh
rename : base/crc.cc => src/base/crc.cc
rename : base/crc.hh => src/base/crc.hh
rename : base/date.cc => src/base/date.cc
rename : base/dbl_list.hh => src/base/dbl_list.hh
rename : base/endian.hh => src/base/endian.hh
rename : base/fast_alloc.cc => src/base/fast_alloc.cc
rename : base/fast_alloc.hh => src/base/fast_alloc.hh
rename : base/fenv.hh => src/base/fenv.hh
rename : base/fifo_buffer.cc => src/base/fifo_buffer.cc
rename : base/fifo_buffer.hh => src/base/fifo_buffer.hh
rename : base/hashmap.hh => src/base/hashmap.hh
rename : base/hostinfo.cc => src/base/hostinfo.cc
rename : base/hostinfo.hh => src/base/hostinfo.hh
rename : base/hybrid_pred.cc => src/base/hybrid_pred.cc
rename : base/hybrid_pred.hh => src/base/hybrid_pred.hh
rename : base/inet.cc => src/base/inet.cc
rename : base/inet.hh => src/base/inet.hh
rename : base/inifile.cc => src/base/inifile.cc
rename : base/inifile.hh => src/base/inifile.hh
rename : base/intmath.cc => src/base/intmath.cc
rename : base/intmath.hh => src/base/intmath.hh
rename : base/kgdb.h => src/base/kgdb.h
rename : base/loader/aout_object.cc => src/base/loader/aout_object.cc
rename : base/loader/aout_object.hh => src/base/loader/aout_object.hh
rename : base/loader/coff_sym.h => src/base/loader/coff_sym.h
rename : base/loader/coff_symconst.h => src/base/loader/coff_symconst.h
rename : base/loader/ecoff_object.cc => src/base/loader/ecoff_object.cc
rename : base/loader/ecoff_object.hh => src/base/loader/ecoff_object.hh
rename : base/loader/elf_object.cc => src/base/loader/elf_object.cc
rename : base/loader/elf_object.hh => src/base/loader/elf_object.hh
rename : base/loader/exec_aout.h => src/base/loader/exec_aout.h
rename : base/loader/exec_ecoff.h => src/base/loader/exec_ecoff.h
rename : base/loader/object_file.cc => src/base/loader/object_file.cc
rename : base/loader/object_file.hh => src/base/loader/object_file.hh
rename : base/loader/symtab.cc => src/base/loader/symtab.cc
rename : base/loader/symtab.hh => src/base/loader/symtab.hh
rename : base/match.cc => src/base/match.cc
rename : base/match.hh => src/base/match.hh
rename : base/misc.cc => src/base/misc.cc
rename : base/misc.hh => src/base/misc.hh
rename : base/mod_num.hh => src/base/mod_num.hh
rename : base/mysql.cc => src/base/mysql.cc
rename : base/mysql.hh => src/base/mysql.hh
rename : base/output.cc => src/base/output.cc
rename : base/output.hh => src/base/output.hh
rename : base/pollevent.cc => src/base/pollevent.cc
rename : base/pollevent.hh => src/base/pollevent.hh
rename : base/predictor.hh => src/base/predictor.hh
rename : base/random.cc => src/base/random.cc
rename : base/random.hh => src/base/random.hh
rename : base/range.cc => src/base/range.cc
rename : base/range.hh => src/base/range.hh
rename : base/refcnt.hh => src/base/refcnt.hh
rename : base/remote_gdb.cc => src/base/remote_gdb.cc
rename : base/remote_gdb.hh => src/base/remote_gdb.hh
rename : base/res_list.hh => src/base/res_list.hh
rename : base/sat_counter.cc => src/base/sat_counter.cc
rename : base/sat_counter.hh => src/base/sat_counter.hh
rename : base/sched_list.hh => src/base/sched_list.hh
rename : base/socket.cc => src/base/socket.cc
rename : base/socket.hh => src/base/socket.hh
rename : base/statistics.cc => src/base/statistics.cc
rename : base/statistics.hh => src/base/statistics.hh
rename : base/stats/events.cc => src/base/stats/events.cc
rename : base/stats/events.hh => src/base/stats/events.hh
rename : base/stats/flags.hh => src/base/stats/flags.hh
rename : base/stats/mysql.cc => src/base/stats/mysql.cc
rename : base/stats/mysql.hh => src/base/stats/mysql.hh
rename : base/stats/mysql_run.hh => src/base/stats/mysql_run.hh
rename : base/stats/output.hh => src/base/stats/output.hh
rename : base/stats/statdb.cc => src/base/stats/statdb.cc
rename : base/stats/statdb.hh => src/base/stats/statdb.hh
rename : base/stats/text.cc => src/base/stats/text.cc
rename : base/stats/text.hh => src/base/stats/text.hh
rename : base/stats/types.hh => src/base/stats/types.hh
rename : base/stats/visit.cc => src/base/stats/visit.cc
rename : base/stats/visit.hh => src/base/stats/visit.hh
rename : base/str.cc => src/base/str.cc
rename : base/str.hh => src/base/str.hh
rename : base/time.cc => src/base/time.cc
rename : base/time.hh => src/base/time.hh
rename : base/timebuf.hh => src/base/timebuf.hh
rename : base/trace.cc => src/base/trace.cc
rename : base/trace.hh => src/base/trace.hh
rename : base/traceflags.py => src/base/traceflags.py
rename : base/userinfo.cc => src/base/userinfo.cc
rename : base/userinfo.hh => src/base/userinfo.hh
rename : cpu/SConscript => src/cpu/SConscript
rename : cpu/base.cc => src/cpu/base.cc
rename : cpu/base.hh => src/cpu/base.hh
rename : cpu/base_dyn_inst.cc => src/cpu/base_dyn_inst.cc
rename : cpu/base_dyn_inst.hh => src/cpu/base_dyn_inst.hh
rename : cpu/cpu_exec_context.cc => src/cpu/cpu_exec_context.cc
rename : cpu/cpu_exec_context.hh => src/cpu/cpu_exec_context.hh
rename : cpu/cpu_models.py => src/cpu/cpu_models.py
rename : cpu/exec_context.hh => src/cpu/exec_context.hh
rename : cpu/exetrace.cc => src/cpu/exetrace.cc
rename : cpu/exetrace.hh => src/cpu/exetrace.hh
rename : cpu/inst_seq.hh => src/cpu/inst_seq.hh
rename : cpu/intr_control.cc => src/cpu/intr_control.cc
rename : cpu/intr_control.hh => src/cpu/intr_control.hh
rename : cpu/memtest/memtest.cc => src/cpu/memtest/memtest.cc
rename : cpu/memtest/memtest.hh => src/cpu/memtest/memtest.hh
rename : cpu/o3/2bit_local_pred.cc => src/cpu/o3/2bit_local_pred.cc
rename : cpu/o3/2bit_local_pred.hh => src/cpu/o3/2bit_local_pred.hh
rename : cpu/o3/alpha_cpu.cc => src/cpu/o3/alpha_cpu.cc
rename : cpu/o3/alpha_cpu.hh => src/cpu/o3/alpha_cpu.hh
rename : cpu/o3/alpha_cpu_builder.cc => src/cpu/o3/alpha_cpu_builder.cc
rename : cpu/o3/alpha_cpu_impl.hh => src/cpu/o3/alpha_cpu_impl.hh
rename : cpu/o3/alpha_dyn_inst.cc => src/cpu/o3/alpha_dyn_inst.cc
rename : cpu/o3/alpha_dyn_inst.hh => src/cpu/o3/alpha_dyn_inst.hh
rename : cpu/o3/alpha_dyn_inst_impl.hh => src/cpu/o3/alpha_dyn_inst_impl.hh
rename : cpu/o3/alpha_impl.hh => src/cpu/o3/alpha_impl.hh
rename : cpu/o3/alpha_params.hh => src/cpu/o3/alpha_params.hh
rename : cpu/o3/bpred_unit.cc => src/cpu/o3/bpred_unit.cc
rename : cpu/o3/bpred_unit.hh => src/cpu/o3/bpred_unit.hh
rename : cpu/o3/bpred_unit_impl.hh => src/cpu/o3/bpred_unit_impl.hh
rename : cpu/o3/btb.cc => src/cpu/o3/btb.cc
rename : cpu/o3/btb.hh => src/cpu/o3/btb.hh
rename : cpu/o3/comm.hh => src/cpu/o3/comm.hh
rename : cpu/o3/commit.cc => src/cpu/o3/commit.cc
rename : cpu/o3/commit.hh => src/cpu/o3/commit.hh
rename : cpu/o3/commit_impl.hh => src/cpu/o3/commit_impl.hh
rename : cpu/o3/cpu.cc => src/cpu/o3/cpu.cc
rename : cpu/o3/cpu.hh => src/cpu/o3/cpu.hh
rename : cpu/o3/cpu_policy.hh => src/cpu/o3/cpu_policy.hh
rename : cpu/o3/decode.cc => src/cpu/o3/decode.cc
rename : cpu/o3/decode.hh => src/cpu/o3/decode.hh
rename : cpu/o3/decode_impl.hh => src/cpu/o3/decode_impl.hh
rename : cpu/o3/fetch.cc => src/cpu/o3/fetch.cc
rename : cpu/o3/fetch.hh => src/cpu/o3/fetch.hh
rename : cpu/o3/fetch_impl.hh => src/cpu/o3/fetch_impl.hh
rename : cpu/o3/free_list.cc => src/cpu/o3/free_list.cc
rename : cpu/o3/free_list.hh => src/cpu/o3/free_list.hh
rename : cpu/o3/iew.cc => src/cpu/o3/iew.cc
rename : cpu/o3/iew.hh => src/cpu/o3/iew.hh
rename : cpu/o3/iew_impl.hh => src/cpu/o3/iew_impl.hh
rename : cpu/o3/inst_queue.cc => src/cpu/o3/inst_queue.cc
rename : cpu/o3/inst_queue.hh => src/cpu/o3/inst_queue.hh
rename : cpu/o3/inst_queue_impl.hh => src/cpu/o3/inst_queue_impl.hh
rename : cpu/o3/mem_dep_unit.cc => src/cpu/o3/mem_dep_unit.cc
rename : cpu/o3/mem_dep_unit.hh => src/cpu/o3/mem_dep_unit.hh
rename : cpu/o3/mem_dep_unit_impl.hh => src/cpu/o3/mem_dep_unit_impl.hh
rename : cpu/o3/ras.cc => src/cpu/o3/ras.cc
rename : cpu/o3/ras.hh => src/cpu/o3/ras.hh
rename : cpu/o3/regfile.hh => src/cpu/o3/regfile.hh
rename : cpu/o3/rename.cc => src/cpu/o3/rename.cc
rename : cpu/o3/rename.hh => src/cpu/o3/rename.hh
rename : cpu/o3/rename_impl.hh => src/cpu/o3/rename_impl.hh
rename : cpu/o3/rename_map.cc => src/cpu/o3/rename_map.cc
rename : cpu/o3/rename_map.hh => src/cpu/o3/rename_map.hh
rename : cpu/o3/rob.cc => src/cpu/o3/rob.cc
rename : cpu/o3/rob.hh => src/cpu/o3/rob.hh
rename : cpu/o3/rob_impl.hh => src/cpu/o3/rob_impl.hh
rename : cpu/o3/sat_counter.cc => src/cpu/o3/sat_counter.cc
rename : cpu/o3/sat_counter.hh => src/cpu/o3/sat_counter.hh
rename : cpu/o3/store_set.cc => src/cpu/o3/store_set.cc
rename : cpu/o3/store_set.hh => src/cpu/o3/store_set.hh
rename : cpu/o3/tournament_pred.cc => src/cpu/o3/tournament_pred.cc
rename : cpu/o3/tournament_pred.hh => src/cpu/o3/tournament_pred.hh
rename : cpu/op_class.cc => src/cpu/op_class.cc
rename : cpu/op_class.hh => src/cpu/op_class.hh
rename : cpu/ozone/cpu.cc => src/cpu/ozone/cpu.cc
rename : cpu/ozone/cpu.hh => src/cpu/ozone/cpu.hh
rename : cpu/ozone/cpu_impl.hh => src/cpu/ozone/cpu_impl.hh
rename : cpu/ozone/ea_list.cc => src/cpu/ozone/ea_list.cc
rename : cpu/ozone/ea_list.hh => src/cpu/ozone/ea_list.hh
rename : cpu/pc_event.cc => src/cpu/pc_event.cc
rename : cpu/pc_event.hh => src/cpu/pc_event.hh
rename : cpu/profile.cc => src/cpu/profile.cc
rename : cpu/profile.hh => src/cpu/profile.hh
rename : cpu/simple/atomic.cc => src/cpu/simple/atomic.cc
rename : cpu/simple/atomic.hh => src/cpu/simple/atomic.hh
rename : cpu/simple/base.cc => src/cpu/simple/base.cc
rename : cpu/simple/base.hh => src/cpu/simple/base.hh
rename : cpu/simple/timing.cc => src/cpu/simple/timing.cc
rename : cpu/simple/timing.hh => src/cpu/simple/timing.hh
rename : cpu/smt.hh => src/cpu/smt.hh
rename : cpu/static_inst.cc => src/cpu/static_inst.cc
rename : cpu/static_inst.hh => src/cpu/static_inst.hh
rename : cpu/trace/opt_cpu.cc => src/cpu/trace/opt_cpu.cc
rename : cpu/trace/opt_cpu.hh => src/cpu/trace/opt_cpu.hh
rename : cpu/trace/reader/ibm_reader.cc => src/cpu/trace/reader/ibm_reader.cc
rename : cpu/trace/reader/ibm_reader.hh => src/cpu/trace/reader/ibm_reader.hh
rename : cpu/trace/reader/itx_reader.cc => src/cpu/trace/reader/itx_reader.cc
rename : cpu/trace/reader/itx_reader.hh => src/cpu/trace/reader/itx_reader.hh
rename : cpu/trace/reader/m5_reader.cc => src/cpu/trace/reader/m5_reader.cc
rename : cpu/trace/reader/m5_reader.hh => src/cpu/trace/reader/m5_reader.hh
rename : cpu/trace/reader/mem_trace_reader.cc => src/cpu/trace/reader/mem_trace_reader.cc
rename : cpu/trace/reader/mem_trace_reader.hh => src/cpu/trace/reader/mem_trace_reader.hh
rename : cpu/trace/trace_cpu.cc => src/cpu/trace/trace_cpu.cc
rename : cpu/trace/trace_cpu.hh => src/cpu/trace/trace_cpu.hh
rename : dev/alpha_access.h => src/dev/alpha_access.h
rename : dev/alpha_console.cc => src/dev/alpha_console.cc
rename : dev/alpha_console.hh => src/dev/alpha_console.hh
rename : dev/baddev.cc => src/dev/baddev.cc
rename : dev/baddev.hh => src/dev/baddev.hh
rename : dev/disk_image.cc => src/dev/disk_image.cc
rename : dev/disk_image.hh => src/dev/disk_image.hh
rename : dev/etherbus.cc => src/dev/etherbus.cc
rename : dev/etherbus.hh => src/dev/etherbus.hh
rename : dev/etherdump.cc => src/dev/etherdump.cc
rename : dev/etherdump.hh => src/dev/etherdump.hh
rename : dev/etherint.cc => src/dev/etherint.cc
rename : dev/etherint.hh => src/dev/etherint.hh
rename : dev/etherlink.cc => src/dev/etherlink.cc
rename : dev/etherlink.hh => src/dev/etherlink.hh
rename : dev/etherpkt.cc => src/dev/etherpkt.cc
rename : dev/etherpkt.hh => src/dev/etherpkt.hh
rename : dev/ethertap.cc => src/dev/ethertap.cc
rename : dev/ethertap.hh => src/dev/ethertap.hh
rename : dev/ide_atareg.h => src/dev/ide_atareg.h
rename : dev/ide_ctrl.cc => src/dev/ide_ctrl.cc
rename : dev/ide_ctrl.hh => src/dev/ide_ctrl.hh
rename : dev/ide_disk.cc => src/dev/ide_disk.cc
rename : dev/ide_disk.hh => src/dev/ide_disk.hh
rename : dev/ide_wdcreg.h => src/dev/ide_wdcreg.h
rename : dev/io_device.cc => src/dev/io_device.cc
rename : dev/io_device.hh => src/dev/io_device.hh
rename : dev/isa_fake.cc => src/dev/isa_fake.cc
rename : dev/isa_fake.hh => src/dev/isa_fake.hh
rename : dev/ns_gige.cc => src/dev/ns_gige.cc
rename : dev/ns_gige.hh => src/dev/ns_gige.hh
rename : dev/ns_gige_reg.h => src/dev/ns_gige_reg.h
rename : dev/pciconfigall.cc => src/dev/pciconfigall.cc
rename : dev/pciconfigall.hh => src/dev/pciconfigall.hh
rename : dev/pcidev.cc => src/dev/pcidev.cc
rename : dev/pcidev.hh => src/dev/pcidev.hh
rename : dev/pcireg.h => src/dev/pcireg.h
rename : dev/pitreg.h => src/dev/pitreg.h
rename : dev/pktfifo.cc => src/dev/pktfifo.cc
rename : dev/pktfifo.hh => src/dev/pktfifo.hh
rename : dev/platform.cc => src/dev/platform.cc
rename : dev/platform.hh => src/dev/platform.hh
rename : dev/rtcreg.h => src/dev/rtcreg.h
rename : dev/simconsole.cc => src/dev/simconsole.cc
rename : dev/simconsole.hh => src/dev/simconsole.hh
rename : dev/simple_disk.cc => src/dev/simple_disk.cc
rename : dev/simple_disk.hh => src/dev/simple_disk.hh
rename : dev/sinic.cc => src/dev/sinic.cc
rename : dev/sinic.hh => src/dev/sinic.hh
rename : dev/sinicreg.hh => src/dev/sinicreg.hh
rename : dev/tsunami.cc => src/dev/tsunami.cc
rename : dev/tsunami.hh => src/dev/tsunami.hh
rename : dev/tsunami_cchip.cc => src/dev/tsunami_cchip.cc
rename : dev/tsunami_cchip.hh => src/dev/tsunami_cchip.hh
rename : dev/tsunami_io.cc => src/dev/tsunami_io.cc
rename : dev/tsunami_io.hh => src/dev/tsunami_io.hh
rename : dev/tsunami_pchip.cc => src/dev/tsunami_pchip.cc
rename : dev/tsunami_pchip.hh => src/dev/tsunami_pchip.hh
rename : dev/tsunamireg.h => src/dev/tsunamireg.h
rename : dev/uart.cc => src/dev/uart.cc
rename : dev/uart.hh => src/dev/uart.hh
rename : dev/uart8250.cc => src/dev/uart8250.cc
rename : dev/uart8250.hh => src/dev/uart8250.hh
rename : kern/kernel_stats.cc => src/kern/kernel_stats.cc
rename : kern/kernel_stats.hh => src/kern/kernel_stats.hh
rename : kern/linux/events.cc => src/kern/linux/events.cc
rename : kern/linux/events.hh => src/kern/linux/events.hh
rename : kern/linux/linux.hh => src/kern/linux/linux.hh
rename : kern/linux/linux_syscalls.cc => src/kern/linux/linux_syscalls.cc
rename : kern/linux/linux_syscalls.hh => src/kern/linux/linux_syscalls.hh
rename : kern/linux/printk.cc => src/kern/linux/printk.cc
rename : kern/linux/printk.hh => src/kern/linux/printk.hh
rename : kern/linux/sched.hh => src/kern/linux/sched.hh
rename : kern/solaris/solaris.hh => src/kern/solaris/solaris.hh
rename : kern/system_events.cc => src/kern/system_events.cc
rename : kern/system_events.hh => src/kern/system_events.hh
rename : kern/tru64/dump_mbuf.cc => src/kern/tru64/dump_mbuf.cc
rename : kern/tru64/dump_mbuf.hh => src/kern/tru64/dump_mbuf.hh
rename : kern/tru64/mbuf.hh => src/kern/tru64/mbuf.hh
rename : kern/tru64/printf.cc => src/kern/tru64/printf.cc
rename : kern/tru64/printf.hh => src/kern/tru64/printf.hh
rename : kern/tru64/tru64.hh => src/kern/tru64/tru64.hh
rename : kern/tru64/tru64_events.cc => src/kern/tru64/tru64_events.cc
rename : kern/tru64/tru64_events.hh => src/kern/tru64/tru64_events.hh
rename : kern/tru64/tru64_syscalls.cc => src/kern/tru64/tru64_syscalls.cc
rename : kern/tru64/tru64_syscalls.hh => src/kern/tru64/tru64_syscalls.hh
rename : mem/bridge.cc => src/mem/bridge.cc
rename : mem/bridge.hh => src/mem/bridge.hh
rename : mem/bus.cc => src/mem/bus.cc
rename : mem/bus.hh => src/mem/bus.hh
rename : mem/cache/prefetch/tagged_prefetcher_impl.hh => src/mem/cache/prefetch/tagged_prefetcher_impl.hh
rename : mem/config/prefetch.hh => src/mem/config/prefetch.hh
rename : mem/mem_object.cc => src/mem/mem_object.cc
rename : mem/mem_object.hh => src/mem/mem_object.hh
rename : mem/packet.cc => src/mem/packet.cc
rename : mem/packet.hh => src/mem/packet.hh
rename : mem/page_table.cc => src/mem/page_table.cc
rename : mem/page_table.hh => src/mem/page_table.hh
rename : mem/physical.cc => src/mem/physical.cc
rename : mem/physical.hh => src/mem/physical.hh
rename : mem/port.cc => src/mem/port.cc
rename : mem/port.hh => src/mem/port.hh
rename : mem/request.hh => src/mem/request.hh
rename : mem/translating_port.cc => src/mem/translating_port.cc
rename : mem/translating_port.hh => src/mem/translating_port.hh
rename : mem/vport.cc => src/mem/vport.cc
rename : mem/vport.hh => src/mem/vport.hh
rename : python/SConscript => src/python/SConscript
rename : python/m5/__init__.py => src/python/m5/__init__.py
rename : python/m5/config.py => src/python/m5/config.py
rename : python/m5/convert.py => src/python/m5/convert.py
rename : python/m5/multidict.py => src/python/m5/multidict.py
rename : python/m5/objects/AlphaConsole.py => src/python/m5/objects/AlphaConsole.py
rename : python/m5/objects/AlphaFullCPU.py => src/python/m5/objects/AlphaFullCPU.py
rename : python/m5/objects/AlphaTLB.py => src/python/m5/objects/AlphaTLB.py
rename : python/m5/objects/BadDevice.py => src/python/m5/objects/BadDevice.py
rename : python/m5/objects/BaseCPU.py => src/python/m5/objects/BaseCPU.py
rename : python/m5/objects/BaseCache.py => src/python/m5/objects/BaseCache.py
rename : python/m5/objects/Bridge.py => src/python/m5/objects/Bridge.py
rename : python/m5/objects/Bus.py => src/python/m5/objects/Bus.py
rename : python/m5/objects/CoherenceProtocol.py => src/python/m5/objects/CoherenceProtocol.py
rename : python/m5/objects/Device.py => src/python/m5/objects/Device.py
rename : python/m5/objects/DiskImage.py => src/python/m5/objects/DiskImage.py
rename : python/m5/objects/Ethernet.py => src/python/m5/objects/Ethernet.py
rename : python/m5/objects/Ide.py => src/python/m5/objects/Ide.py
rename : python/m5/objects/IntrControl.py => src/python/m5/objects/IntrControl.py
rename : python/m5/objects/MemObject.py => src/python/m5/objects/MemObject.py
rename : python/m5/objects/MemTest.py => src/python/m5/objects/MemTest.py
rename : python/m5/objects/Pci.py => src/python/m5/objects/Pci.py
rename : python/m5/objects/PhysicalMemory.py => src/python/m5/objects/PhysicalMemory.py
rename : python/m5/objects/Platform.py => src/python/m5/objects/Platform.py
rename : python/m5/objects/Process.py => src/python/m5/objects/Process.py
rename : python/m5/objects/Repl.py => src/python/m5/objects/Repl.py
rename : python/m5/objects/Root.py => src/python/m5/objects/Root.py
rename : python/m5/objects/SimConsole.py => src/python/m5/objects/SimConsole.py
rename : python/m5/objects/SimpleDisk.py => src/python/m5/objects/SimpleDisk.py
rename : python/m5/objects/System.py => src/python/m5/objects/System.py
rename : python/m5/objects/Tsunami.py => src/python/m5/objects/Tsunami.py
rename : python/m5/objects/Uart.py => src/python/m5/objects/Uart.py
rename : python/m5/smartdict.py => src/python/m5/smartdict.py
rename : sim/async.hh => src/sim/async.hh
rename : sim/builder.cc => src/sim/builder.cc
rename : sim/builder.hh => src/sim/builder.hh
rename : sim/byteswap.hh => src/sim/byteswap.hh
rename : sim/debug.cc => src/sim/debug.cc
rename : sim/debug.hh => src/sim/debug.hh
rename : sim/eventq.cc => src/sim/eventq.cc
rename : sim/eventq.hh => src/sim/eventq.hh
rename : sim/faults.cc => src/sim/faults.cc
rename : sim/faults.hh => src/sim/faults.hh
rename : sim/host.hh => src/sim/host.hh
rename : sim/main.cc => src/sim/main.cc
rename : sim/param.cc => src/sim/param.cc
rename : sim/param.hh => src/sim/param.hh
rename : sim/process.cc => src/sim/process.cc
rename : sim/process.hh => src/sim/process.hh
rename : sim/pseudo_inst.cc => src/sim/pseudo_inst.cc
rename : sim/pseudo_inst.hh => src/sim/pseudo_inst.hh
rename : sim/root.cc => src/sim/root.cc
rename : sim/serialize.cc => src/sim/serialize.cc
rename : sim/serialize.hh => src/sim/serialize.hh
rename : sim/sim_events.cc => src/sim/sim_events.cc
rename : sim/sim_events.hh => src/sim/sim_events.hh
rename : sim/sim_exit.hh => src/sim/sim_exit.hh
rename : sim/sim_object.cc => src/sim/sim_object.cc
rename : sim/sim_object.hh => src/sim/sim_object.hh
rename : sim/startup.cc => src/sim/startup.cc
rename : sim/startup.hh => src/sim/startup.hh
rename : sim/stat_control.cc => src/sim/stat_control.cc
rename : sim/stat_control.hh => src/sim/stat_control.hh
rename : sim/stats.hh => src/sim/stats.hh
rename : sim/syscall_emul.cc => src/sim/syscall_emul.cc
rename : sim/syscall_emul.hh => src/sim/syscall_emul.hh
rename : sim/system.cc => src/sim/system.cc
rename : sim/system.hh => src/sim/system.hh
rename : sim/vptr.hh => src/sim/vptr.hh
rename : test/Makefile => src/unittest/Makefile
rename : test/bitvectest.cc => src/unittest/bitvectest.cc
rename : test/circletest.cc => src/unittest/circletest.cc
rename : test/cprintftest.cc => src/unittest/cprintftest.cc
rename : test/foo.ini => src/unittest/foo.ini
rename : test/genini.py => src/unittest/genini.py
rename : test/initest.cc => src/unittest/initest.cc
rename : test/initest.ini => src/unittest/initest.ini
rename : test/lru_test.cc => src/unittest/lru_test.cc
rename : test/nmtest.cc => src/unittest/nmtest.cc
rename : test/offtest.cc => src/unittest/offtest.cc
rename : test/paramtest.cc => src/unittest/paramtest.cc
rename : test/rangetest.cc => src/unittest/rangetest.cc
rename : test/sized_test.cc => src/unittest/sized_test.cc
rename : test/stattest.cc => src/unittest/stattest.cc
rename : test/strnumtest.cc => src/unittest/strnumtest.cc
rename : test/symtest.cc => src/unittest/symtest.cc
rename : test/tokentest.cc => src/unittest/tokentest.cc
rename : test/tracetest.cc => src/unittest/tracetest.cc
extra : convert_revision : cab6a5271ca1b368193cd948e5d3dcc47ab1bd48
This commit is contained in:
Steve Reinhardt
2006-05-22 14:29:33 -04:00
parent 86777c9db1
commit ba2eae5d52
649 changed files with 11034 additions and 266 deletions

98
src/unittest/Makefile Normal file
View File

@@ -0,0 +1,98 @@
# Copyright (c) 2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Nathan Binkert
# Steve Reinhardt
CC?= gcc
CXX?= g++
PYTHON?=/usr/bin/env python
CURDIR?= $(shell /bin/pwd)
SRCDIR?= $(CURDIR)/..
CCFLAGS= -g -O0 -MMD -I. -I$(SRCDIR) -I- -DTRACING_ON=0
MYSQL= -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient
VPATH=$(SRCDIR):$(CURDIR)
default:
@echo "You must specify a target"
base/traceflags.cc base/traceflags.hh: $(SRCDIR)/base/traceflags.py
mkdir -p base; \
cd base; \
$(PYTHON) $<
bitvectest: test/bitvectest.cc
$(CXX) $(CCFLAGS) -o $@ $^
circletest: test/circletest.cc base/circlebuf.cc
$(CXX) $(CCFLAGS) -o $@ $^
cprintftest: test/cprintftest.cc base/cprintf.cc
$(CXX) $(CCFLAGS) -o $@ $^
initest: test/initest.cc base/str.cc base/inifile.cc base/cprintf.cc
$(CXX) $(CCFLAGS) -o $@ $^
lrutest: test/lru_test.cc
$(CXX) $(CCFLAGS) -o $@ $^
nmtest: test/nmtest.cc base/output.cc base/hostinfo.cc base/cprintf.cc base/misc.cc base/loader/object_file.cc base/loader/symtab.cc base/misc.cc base/str.cc base/loader/aout_object.cc base/loader/ecoff_object.cc base/loader/elf_object.cc
$(CXX) $(CCFLAGS) -I/n/ziff/z/binkertn/build/work/ALPHA_FS -lelf -o $@ $^
offtest: test/offtest.cc
$(CXX) $(CCFLAGS) -o $@ $^
rangetest: test/rangetest.cc base/range.cc base/str.cc
$(CXX) $(CCFLAGS) -o $@ $^
STATTEST+= base/cprintf.cc base/hostinfo.cc base/misc.cc base/mysql.cc
STATTEST+= base/python.cc base/str.cc base/time.cc
STATTEST+= base/statistics.cc base/stats/mysql.cc base/stats/python.cc
STATTEST+= base/stats/statdb.cc base/stats/text.cc base/stats/visit.cc
STATTEST+= test/stattest.cc
stattest: $(STATTEST)
$(CXX) $(CCFLAGS) $(MYSQL) -o $@ $^
strnumtest: test/strnumtest.cc base/str.cc
$(CXX) $(CCFLAGS) -o $@ $^
symtest: test/symtest.cc base/misc.cc base/symtab.cc base/str.cc
$(CXX) $(CCFLAGS) -o $@ $^
tokentest: test/tokentest.cc base/str.cc
$(CXX) $(CCFLAGS) -o $@ $^
TRACE+=test/tracetest.cc base/trace.cc base/trace_flags.cc base/cprintf.cc
TRACE+=base/str.cc base/misc.cc
tracetest: $(TRACE)
$(CXX) $(CCFLAGS) -o $@ $^
clean:
@rm -rf *test *~ .#* *.core core base
.PHONY: clean

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream.h>
#include <vector>
int
main()
{
vector<bool> v1(100);
v1[0] = true;
v1.resize(500);
v1[100] = true;
v1[499] = true;
v1.resize(10000);
v1[9999] = true;
cout << "v1.size() = " << v1.size() << "\n";
for (int i = 0; i < v1.size(); i++)
if (v1[i])
cout << "v1[" << i << "] = " << v1[i] << "\n";
cout << "\n";
vector<bool> v2 = v1;
for (int i = 0; i < v2.size(); i++)
if (v2[i])
cout << "v2[" << i << "] = " << v2[i] << "\n";
cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
v2[8583] = true;
cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
v1[8583] = true;
cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
v1.resize(100000);
cout << "v1 " << ((v1 == v2) ? "==" : "!=") << " v2" << "\n";
cout << flush;
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <fcntl.h>
#include <iostream.h>
#include <unistd.h>
#include "base/circlebuf.hh"
char *strings[] =
{ "This is the first test\n",
"he went with his woman to the store\n",
"the man with the bat hit the woman with the hat\n",
"that that is is that that was\n",
"sue sells sea shells by the sea shore\n",
"go to the store and buy me some milk and bread\n",
"the friendly flight attendants spoke soothingly to the frightened passengers in their native languages\n"
};
const int num_strings = sizeof(strings) / sizeof(char *);
int
main()
{
CircleBuf buf(1024);
for (int count = 0; count < 100; count++)
buf.write(strings[count % num_strings]);
buf.read(STDOUT_FILENO);
write(STDOUT_FILENO, "<\n", 2);
for (int count = 0; count < 100; count++)
buf.write(strings[count % num_strings]);
buf.read(STDOUT_FILENO, 100);
write(STDOUT_FILENO, "<\n", 2);
buf.flush();
buf.write("asdfa asdf asd fasdf asdf\n");
buf.write("");
buf.write("");
buf.write("");
buf.write("");
buf.write("");
buf.write("");
buf.read(STDOUT_FILENO);
write(STDOUT_FILENO, "<\n", 2);
}

163
src/unittest/cprintftest.cc Normal file
View File

@@ -0,0 +1,163 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <list>
#include <string>
#include <sstream>
#include "base/cprintf.hh"
using namespace std;
int
main()
{
char foo[9];
cprintf("%s\n", foo);
cprintf("%shits%%s + %smisses%%s\n", "test", "test");
cprintf("%%s%-10s %c he went home \'\"%d %#o %#x %1.5f %1.2E\n",
"hello", 'A', 1, 0xff, 0xfffffffffffffULL, 3.141592653589, 1.1e10);
cout << cformat("%s %#x %s\n") << "hello" << 0 << "foo 0\n";
cerr << cformat("%s %#x\n") << "hello" << 1 << "foo 1\n";
cprintf("another test\n");
stringstream buffer;
ccprintf(buffer, "%-10s %c he home \'\"%d %#o %#x %1.5f %1.2E\n",
"hello", 'A', 1, 0xff, 0xfffffffffffffULL, 3.14159265, 1.1e10);
double f = 314159.26535897932384;
#define ctest(x, y) printf(x, y); cprintf(x, y); cprintf("\n");
ctest("%1.8f\n", f);
ctest("%2.8f\n", f);
ctest("%3.8f\n", f);
ctest("%4.8f\n", f);
ctest("%5.8f\n", f);
ctest("%6.8f\n", f);
ctest("%12.8f\n", f);
ctest("%1000.8f\n", f);
ctest("%1.0f\n", f);
ctest("%1.1f\n", f);
ctest("%1.2f\n", f);
ctest("%1.3f\n", f);
ctest("%1.4f\n", f);
ctest("%1.5f\n", f);
ctest("%1.6f\n", f);
ctest("%1.7f\n", f);
ctest("%1.8f\n", f);
ctest("%1.9f\n", f);
ctest("%1.10f\n", f);
ctest("%1.11f\n", f);
ctest("%1.12f\n", f);
ctest("%1.13f\n", f);
ctest("%1.14f\n", f);
ctest("%1.15f\n", f);
ctest("%1.16f\n", f);
ctest("%1.17f\n", f);
ctest("%1.18f\n", f);
cout << "foo\n";
f = 0.00000026535897932384;
ctest("%1.8f\n", f);
ctest("%2.8f\n", f);
ctest("%3.8f\n", f);
ctest("%4.8f\n", f);
ctest("%5.8f\n", f);
ctest("%6.8f\n", f);
ctest("%12.8f\n", f);
ctest("%1.0f\n", f);
ctest("%1.1f\n", f);
ctest("%1.2f\n", f);
ctest("%1.3f\n", f);
ctest("%1.4f\n", f);
ctest("%1.5f\n", f);
ctest("%1.6f\n", f);
ctest("%1.7f\n", f);
ctest("%1.8f\n", f);
ctest("%1.9f\n", f);
ctest("%1.10f\n", f);
ctest("%1.11f\n", f);
ctest("%1.12f\n", f);
ctest("%1.13f\n", f);
ctest("%1.14f\n", f);
ctest("%1.15f\n", f);
ctest("%1.16f\n", f);
ctest("%1.17f\n", f);
ctest("%1.18f\n", f);
f = 0.00000026535897932384;
ctest("%1.8e\n", f);
ctest("%2.8e\n", f);
ctest("%3.8e\n", f);
ctest("%4.8e\n", f);
ctest("%5.8e\n", f);
ctest("%6.8e\n", f);
ctest("%12.8e\n", f);
ctest("%1.0e\n", f);
ctest("%1.1e\n", f);
ctest("%1.2e\n", f);
ctest("%1.3e\n", f);
ctest("%1.4e\n", f);
ctest("%1.5e\n", f);
ctest("%1.6e\n", f);
ctest("%1.7e\n", f);
ctest("%1.8e\n", f);
ctest("%1.9e\n", f);
ctest("%1.10e\n", f);
ctest("%1.11e\n", f);
ctest("%1.12e\n", f);
ctest("%1.13e\n", f);
ctest("%1.14e\n", f);
ctest("%1.15e\n", f);
ctest("%1.16e\n", f);
ctest("%1.17e\n", f);
ctest("%1.18e\n", f);
cout << buffer.str();
cout.width(0);
cout.precision(1);
cout << f << "\n";
string foo1 = "string test";
cprintf("%s\n", foo1);
stringstream foo2;
foo2 << "stringstream test";
cprintf("%s\n", foo2);
cprintf("%c %c\n", 'c', 65);
cout << '9';
return 0;
}

10
src/unittest/foo.ini Normal file
View File

@@ -0,0 +1,10 @@
#define JUNK
[Foo]
Foo1=89
Foo2=384
[General]
Test3=89
[Junk]
Test4+=mia

72
src/unittest/genini.py Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env python
# Copyright (c) 2005 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import getopt, os, os.path, sys
from os.path import join as joinpath, realpath
mypath = sys.path[0]
sys.path.append(joinpath(mypath, '..'))
sys.path.append(joinpath(mypath, '../python'))
sys.path.append(joinpath(mypath, '../util/pbs'))
pathlist = [ '.' ]
m5_build_env = {}
try:
opts, args = getopt.getopt(sys.argv[1:], '-E:I:')
for opt,arg in opts:
if opt == '-E':
offset = arg.find('=')
if offset == -1:
name = arg
value = 'True'
else:
name = arg[:offset]
value = arg[offset+1:]
os.environ[name] = value
m5_build_env[name] = value
if opt == '-I':
pathlist.append(arg)
except getopt.GetoptError:
sys.exit('Improper Usage')
import __main__
__main__.m5_build_env = m5_build_env
from m5 import *
for path in pathlist:
AddToPath(path)
for arg in args:
m5execfile(arg, globals())
if globals().has_key('root') and isinstance(root, Root):
instantiate(root)
else:
print "Instantiation skipped: no root object found."

142
src/unittest/initest.cc Normal file
View File

@@ -0,0 +1,142 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "base/inifile.hh"
#include "base/cprintf.hh"
using namespace std;
char *progname;
void
usage()
{
cout << "Usage: " << progname << " <ini file>\n";
exit(1);
}
#if 0
char *defines = getenv("CONFIG_DEFINES");
if (defines) {
char *c = defines;
while ((c = strchr(c, ' ')) != NULL) {
*c++ = '\0';
count++;
}
count++;
}
#endif
int
main(int argc, char *argv[])
{
IniFile simConfigDB;
progname = argv[0];
vector<char *> cppArgs;
vector<char *> cpp_options;
cpp_options.reserve(argc * 2);
for (int i = 1; i < argc; ++i) {
char *arg_str = argv[i];
// if arg starts with '-', parse as option,
// else treat it as a configuration file name and load it
if (arg_str[0] == '-') {
// switch on second char
switch (arg_str[1]) {
case 'D':
case 'U':
case 'I':
// cpp options: record & pass to cpp. Note that these
// cannot have spaces, i.e., '-Dname=val' is OK, but
// '-D name=val' is not. I don't consider this a
// problem, since even though gnu cpp accepts the
// latter, other cpp implementations do not (Tru64,
// for one).
cppArgs.push_back(arg_str);
break;
case '-':
// command-line configuration parameter:
// '--<section>:<parameter>=<value>'
if (!simConfigDB.add(arg_str + 2)) {
// parse error
ccprintf(cerr,
"Could not parse configuration argument '%s'\n"
"Expecting --<section>:<parameter>=<value>\n",
arg_str);
exit(0);
}
break;
default:
usage();
}
}
else {
// no '-', treat as config file name
if (!simConfigDB.loadCPP(arg_str, cppArgs)) {
cprintf("Error processing file %s\n", arg_str);
exit(1);
}
}
}
string value;
#define FIND(C, E) \
if (simConfigDB.find(C, E, value)) \
cout << ">" << value << "<\n"; \
else \
cout << "Not Found!\n"
FIND("General", "Test2");
FIND("Junk", "Test3");
FIND("Junk", "Test4");
FIND("General", "Test1");
FIND("Junk2", "test3");
FIND("General", "Test3");
cout << "\n";
simConfigDB.dump();
return 0;
}

14
src/unittest/initest.ini Normal file
View File

@@ -0,0 +1,14 @@
#define JUNK
// General stuff
#define FOO(X) BAR##X
[General]
Test1=FOO(asdf)
Test2=bar
#ifdef JUNK
[Junk] // This is the junk
Test3=yo
Test4=mama
#endif
#include "foo.ini"

82
src/unittest/lru_test.cc Normal file
View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include "bhgp.hh"
int main(void)
{
typedef AssociativeTable<unsigned int, unsigned int> tableType;
tableType table(10, 4); // 40 entry table
std::cout << "Initial state:" << std::endl;
table.dump();
std::cout << "Inserting (2, 1)" << std::endl;
table[2] = 1;
table.dump();
std::cout << "Inserting (5, 2)" << std::endl;
table[5] = 2;
table.dump();
std::cout << "Inserting (10 + 2, 3)" << std::endl;
table[10 + 2] = 3;
table.dump();
tableType::const_iterator i = table.find(2);
assert(i != table.end());
std::cout << "Accessed 2: " << *i << std::endl;
table.dump();
i = table.find(10 + 2);
assert(i != table.end());
std::cout << "Accessed 10 + 2: " << *i << std::endl;
table.dump();
i = table.find(34);
assert(i == table.end());
std::cout << "Inserting (2 * 10 + 2, 4)" << std::endl;
table[2 * 10 + 2] = 4;
table.dump();
std::cout << "Replacing (10 + 2) with 5" << std::endl;
table[10 + 2] = 5;
table.dump();
std::cout << "Inserting (3 * 10 + 2, 6)" << std::endl;
table[3 * 10 + 2] = 6;
table.dump();
std::cout << "Inserting (4 * 10 + 2, 7)" << std::endl;
table[4 * 10 + 2] = 7;
table.dump();
return(0);
}

83
src/unittest/nmtest.cc Normal file
View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <string>
#include <vector>
#include "base/loader/object_file.hh"
#include "base/loader/symtab.hh"
#include "base/misc.hh"
#include "base/str.hh"
using namespace std;
Tick curTick;
ostream *outputStream = &cout;
int
main(int argc, char *argv[])
{
if (argc != 2 && argc != 3)
panic("usage: %s <filename> <symbol>\n", argv[0]);
ObjectFile *obj = createObjectFile(argv[1]);
if (!obj)
panic("file not found\n");
SymbolTable symtab;
obj->loadGlobalSymbols(&symtab);
obj->loadLocalSymbols(&symtab);
if (argc == 2) {
SymbolTable::ATable::const_iterator i = symtab.getAddrTable().begin();
SymbolTable::ATable::const_iterator end = symtab.getAddrTable().end();
while (i != end) {
cprintf("%#x %s\n", i->first, i->second);
++i;
}
} else {
string symbol = argv[2];
Addr address;
if (symbol[0] == '0' && symbol[1] == 'x') {
if (to_number(symbol, address) &&
symtab.findSymbol(address, symbol))
cprintf("address = %#x, symbol = %s\n", address, symbol);
else
cprintf("address = %#x was not found\n", address);
} else {
if (symtab.findAddress(symbol, address))
cprintf("symbol = %s address = %#x\n", symbol, address);
else
cprintf("symbol = %s was not found\n", symbol);
}
}
return 0;
}

70
src/unittest/offtest.cc Normal file
View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <stddef.h>
#include <stdio.h>
#include "dev/pcireg.h"
int
main()
{
#define POFFSET(x) \
printf("offsetof(PCIConfig, hdr."#x") = %d\n", \
offsetof(PCIConfig, hdr.x))
POFFSET(vendor);
POFFSET(device);
POFFSET(command);
POFFSET(status);
POFFSET(revision);
POFFSET(progIF);
POFFSET(subClassCode);
POFFSET(classCode);
POFFSET(cacheLineSize);
POFFSET(latencyTimer);
POFFSET(headerType);
POFFSET(bist);
POFFSET(pci0.baseAddr0);
POFFSET(pci0.baseAddr1);
POFFSET(pci0.baseAddr2);
POFFSET(pci0.baseAddr3);
POFFSET(pci0.baseAddr4);
POFFSET(pci0.baseAddr5);
POFFSET(pci0.cardbusCIS);
POFFSET(pci0.subsystemVendorID);
POFFSET(pci0.expansionROM);
POFFSET(pci0.reserved0);
POFFSET(pci0.reserved1);
POFFSET(pci0.interruptLine);
POFFSET(pci0.interruptPin);
POFFSET(pci0.minimumGrant);
POFFSET(pci0.minimumLatency);
return 0;
}

105
src/unittest/paramtest.cc Normal file
View File

@@ -0,0 +1,105 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//
// This file is not part of the regular simulator. It is solely for
// testing the parameter code. Edit the Makefile to add param_test.cc
// to the sources list, then use configs/test.ini as the configuration
// file.
//
#include "sim/sim_object.hh"
#include "mem/cache/cache.hh"
class ParamTest : public SimObject
{
public:
ParamTest(string name)
: SimObject(name)
{
}
virtual ~ParamTest() {}
};
enum Enum1Type { Enum0 };
enum Enum2Type { Enum10 };
BEGIN_DECLARE_SIM_OBJECT_PARAMS(ParamTest)
Param<int> intparam;
VectorParam<int> vecint;
Param<string> stringparam;
VectorParam<string> vecstring;
Param<bool> boolparam;
VectorParam<bool> vecbool;
SimObjectParam<BaseMemory *> memobj;
SimObjectVectorParam<BaseMemory *> vecmemobj;
SimpleEnumParam<Enum1Type> enum1;
MappedEnumParam<Enum2Type> enum2;
SimpleEnumVectorParam<Enum1Type> vecenum1;
MappedEnumVectorParam<Enum2Type> vecenum2;
END_DECLARE_SIM_OBJECT_PARAMS(ParamTest)
const char *enum1_strings[] =
{
"zero", "one", "two", "three"
};
const EnumParamMap enum2_map[] =
{
{ "ten", 10 },
{ "twenty", 20 },
{ "thirty", 30 },
{ "forty", 40 }
};
BEGIN_INIT_SIM_OBJECT_PARAMS(ParamTest)
INIT_PARAM(intparam, "intparam"),
INIT_PARAM(vecint, "vecint"),
INIT_PARAM(stringparam, "stringparam"),
INIT_PARAM(vecstring, "vecstring"),
INIT_PARAM(boolparam, "boolparam"),
INIT_PARAM(vecbool, "vecbool"),
INIT_PARAM(memobj, "memobj"),
INIT_PARAM(vecmemobj, "vecmemobj"),
INIT_ENUM_PARAM(enum1, "enum1", enum1_strings),
INIT_ENUM_PARAM(enum2, "enum2", enum2_map),
INIT_ENUM_PARAM(vecenum1, "vecenum1", enum1_strings),
INIT_ENUM_PARAM(vecenum2, "vecenum2", enum2_map)
END_INIT_SIM_OBJECT_PARAMS(ParamTest)
CREATE_SIM_OBJECT(ParamTest)
{
return new ParamTest(getInstanceName());
}
REGISTER_SIM_OBJECT("ParamTest", ParamTest)

74
src/unittest/rangetest.cc Normal file
View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <string>
#include "base/range.hh"
using namespace std;
int
main()
{
Range<int> r1(make_pair(9, 28));
Range<unsigned> r2("0x1000:+0x100");
cout << r1 << "\n"
<< r2 << "\n";
#define RANGETEST(X, C, Y) \
cout << X << " "#C" " << Y << " => " << ((X C Y) ? "true" : "false") << "\n"
#define TESTEM(X, Y) do { \
RANGETEST(X, < , Y); \
RANGETEST(X, <=, Y); \
RANGETEST(X, > , Y); \
RANGETEST(X, >=, Y); \
RANGETEST(X, ==, Y); \
RANGETEST(X, !=, Y); \
RANGETEST(Y, < , X); \
RANGETEST(Y, <=, X); \
RANGETEST(Y, > , X); \
RANGETEST(Y, >=, X); \
RANGETEST(Y, ==, X); \
RANGETEST(Y, !=, X); \
} while (0)
TESTEM(8, r1);
TESTEM(9, r1);
TESTEM(27, r1);
TESTEM(28, r1);
TESTEM(0x0fff, r2);
TESTEM(0x1000, r2);
TESTEM(0x10ff, r2);
TESTEM(0x1100, r2);
return 0;
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <algorithm>
#include "sized.hh"
#include <queue>
#include <typeinfo>
template<typename C>
void print(C &cont)
{
std::cout << std::endl;
std::cout << "Printing " << typeid(cont).name() << std::endl;
while (!cont.empty()) {
std::cout << cont.front() << " ";
cont.pop();
}
std::cout << std::endl;
}
int main(void)
{
sized<std::queue<int>, sized_error_policy<std::queue<int> > >
error_queue(10);
sized<std::queue<int>, sized_drop_policy<std::queue<int> > >
drop_queue(5);
for (int i = 0; i < 10; ++i) {
error_queue.push(i);
}
for (int i = 0; i < 3; ++i) {
drop_queue.push(i);
}
print(error_queue);
print(drop_queue);
return(0);
}

560
src/unittest/stattest.cc Normal file
View File

@@ -0,0 +1,560 @@
/*
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iomanip>
#include <iostream>
#include <fstream>
#include <string>
#include <unistd.h>
#include "base/cprintf.hh"
#include "base/misc.hh"
#include "base/statistics.hh"
#include "base/stats/text.hh"
#include "base/stats/mysql.hh"
#include "sim/host.hh"
using namespace std;
using namespace Stats;
Tick curTick = 0;
Tick ticksPerSecond = ULL(2000000000);
Scalar<> s1;
Scalar<> s2;
Average<> s3;
Scalar<MainBin> s4;
Vector<MainBin> s5;
Distribution<MainBin> s6;
Vector<MainBin> s7;
AverageVector<> s8;
StandardDeviation<> s9;
AverageDeviation<> s10;
Scalar<> s11;
Distribution<> s12;
VectorDistribution<> s13;
VectorStandardDeviation<> s14;
VectorAverageDeviation<> s15;
Vector2d<> s16;
Formula f1;
Formula f2;
Formula f3;
Value f4;
Value f5;
Formula f6;
Formula f7;
MainBin bin1("bin1");
MainBin bin2("bin2");
ostream *outputStream = &cout;
double
testfunc()
{
return 9.8;
}
class TestClass {
public:
double operator()() { return 9.7; }
};
char *progname = "";
void
usage()
{
panic("incorrect usage.\n"
"usage:\n"
"\t%s [-t [-c] [-d]]\n", progname);
}
int
main(int argc, char *argv[])
{
bool descriptions = false;
bool compat = false;
bool text = false;
string mysql_name;
string mysql_host;
string mysql_user = "binkertn";
string mysql_passwd;
char c;
progname = argv[0];
while ((c = getopt(argc, argv, "cdh:P:p:s:tu:")) != -1) {
switch (c) {
case 'c':
compat = true;
break;
case 'd':
descriptions = true;
break;
case 'h':
mysql_host = optarg;
break;
case 'P':
mysql_passwd = optarg;
break;
case 's':
mysql_name = optarg;
break;
case 't':
text = true;
break;
case 'u':
mysql_user = optarg;
break;
default:
usage();
}
}
if (!text && (compat || descriptions))
usage();
s5.init(5);
s6.init(1, 100, 13);
s7.init(7);
s8.init(10);
s12.init(1, 100, 13);
s13.init(4, 0, 99, 10);
s14.init(9);
s15.init(10);
s16.init(2, 9);
s1
.name("Stat01")
.desc("this is statistic 1")
;
s2
.name("Stat02")
.desc("this is statistic 2")
.prereq(s11)
;
s3
.name("Stat03")
.desc("this is statistic 3")
.prereq(f7)
;
s4
.name("Stat04")
.desc("this is statistic 4")
.prereq(s11)
;
s5
.name("Stat05")
.desc("this is statistic 5")
.prereq(s11)
.subname(0, "foo1")
.subname(1, "foo2")
.subname(2, "foo3")
.subname(3, "foo4")
.subname(4, "foo5")
;
s6
.name("Stat06")
.desc("this is statistic 6")
.prereq(s11)
;
s7
.name("Stat07")
.desc("this is statistic 7")
.precision(1)
.flags(pdf | total)
.prereq(s11)
;
s8
.name("Stat08")
.desc("this is statistic 8")
.precision(2)
.prereq(s11)
.subname(4, "blarg")
;
s9
.name("Stat09")
.desc("this is statistic 9")
.precision(4)
.prereq(s11)
;
s10
.name("Stat10")
.desc("this is statistic 10")
.prereq(s11)
;
s12
.name("Stat12")
.desc("this is statistic 12")
;
s13
.name("Stat13")
.desc("this is statistic 13")
;
s14
.name("Stat14")
.desc("this is statistic 14")
;
s15
.name("Stat15")
.desc("this is statistic 15")
;
s16
.name("Stat16")
.desc("this is statistic 16")
.flags(total)
.subname(0, "sub0")
.subname(1, "sub1")
.ysubname(0, "y0")
.ysubname(1, "y1")
;
f1
.name("Formula1")
.desc("this is formula 1")
.prereq(s11)
;
f2
.name("Formula2")
.desc("this is formula 2")
.prereq(s11)
.precision(1)
;
f3
.name("Formula3")
.desc("this is formula 3")
.prereq(s11)
.subname(0, "bar1")
.subname(1, "bar2")
.subname(2, "bar3")
.subname(3, "bar4")
.subname(4, "bar5")
;
f4
.functor(testfunc)
.name("Formula4")
.desc("this is formula 4")
;
TestClass testclass;
f5
.functor(testclass)
.name("Formula5")
.desc("this is formula 5")
;
f6
.name("Formula6")
.desc("this is formula 6")
;
f1 = s1 + s2;
f2 = (-s1) / (-s2) * (-s3 + ULL(100) + s4);
f3 = sum(s5) * s7;
f6 += constant(10.0);
f6 += s5[3];
f7 = constant(1);
check();
reset();
bin1.activate();
s16[1][0] = 1;
s16[0][1] = 3;
s16[0][0] = 2;
s16[1][1] = 9;
s16[1][1] += 9;
s16[1][8] += 8;
s16[1][7] += 7;
s16[1][6] += 6;
s16[1][5] += 5;
s16[1][4] += 4;
s11 = 1;
s3 = 9;
s8[3] = 9;
s15[0].sample(1234);
s15[1].sample(1234);
s15[2].sample(1234);
s15[3].sample(1234);
s15[4].sample(1234);
s15[5].sample(1234);
s15[6].sample(1234);
s15[7].sample(1234);
s15[8].sample(1234);
s15[9].sample(1234);
s10.sample(1000000000);
curTick += ULL(1000000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s10.sample(100000);
s13[0].sample(12);
s13[1].sample(29);
s13[2].sample(12);
s13[3].sample(29);
s13[0].sample(42);
s13[1].sample(29);
s13[2].sample(42);
s13[3].sample(32);
s13[0].sample(52);
s13[1].sample(49);
s13[2].sample(42);
s13[3].sample(25);
s13[0].sample(32);
s13[1].sample(49);
s13[2].sample(22);
s13[3].sample(49);
s13[0].sample(62);
s13[1].sample(99);
s13[2].sample(72);
s13[3].sample(23);
s13[0].sample(52);
s13[1].sample(78);
s13[2].sample(69);
s13[3].sample(49);
s14[0].sample(1234);
s14[1].sample(4134);
s14[4].sample(1213);
s14[3].sample(1124);
s14[2].sample(1243);
s14[7].sample(1244);
s14[4].sample(7234);
s14[2].sample(9234);
s14[3].sample(1764);
s14[7].sample(1564);
s14[3].sample(3234);
s14[1].sample(2234);
s14[5].sample(1234);
s14[2].sample(4334);
s14[2].sample(1234);
s14[4].sample(4334);
s14[6].sample(1234);
s14[8].sample(8734);
s14[1].sample(5234);
s14[3].sample(8234);
s14[7].sample(5234);
s14[4].sample(4434);
s14[3].sample(7234);
s14[2].sample(1934);
s14[1].sample(9234);
s14[5].sample(5634);
s14[3].sample(1264);
s14[7].sample(5223);
s14[0].sample(1234);
s14[0].sample(5434);
s14[3].sample(8634);
s14[1].sample(1234);
s15[0].sample(1234);
s15[1].sample(4134);
curTick += ULL(1000000);
s15[4].sample(1213);
curTick += ULL(1000000);
s15[3].sample(1124);
curTick += ULL(1000000);
s15[2].sample(1243);
curTick += ULL(1000000);
s15[7].sample(1244);
curTick += ULL(1000000);
s15[4].sample(7234);
s15[2].sample(9234);
s15[3].sample(1764);
s15[7].sample(1564);
s15[3].sample(3234);
s15[1].sample(2234);
curTick += ULL(1000000);
s15[5].sample(1234);
curTick += ULL(1000000);
s15[9].sample(4334);
curTick += ULL(1000000);
s15[2].sample(1234);
curTick += ULL(1000000);
s15[4].sample(4334);
s15[6].sample(1234);
curTick += ULL(1000000);
s15[8].sample(8734);
curTick += ULL(1000000);
s15[1].sample(5234);
curTick += ULL(1000000);
s15[3].sample(8234);
curTick += ULL(1000000);
s15[7].sample(5234);
s15[4].sample(4434);
s15[3].sample(7234);
s15[2].sample(1934);
s15[1].sample(9234);
curTick += ULL(1000000);
s15[5].sample(5634);
s15[3].sample(1264);
s15[7].sample(5223);
s15[0].sample(1234);
s15[0].sample(5434);
s15[3].sample(8634);
curTick += ULL(1000000);
s15[1].sample(1234);
s4 = curTick;
s8[3] = 99999;
s3 = 12;
s3++;
curTick += 9;
s1 = 9;
s1 += 9;
s1 -= 11;
s1++;
++s1;
s1--;
--s1;
s2 = 9;
s5[0] += 1;
s5[1] += 2;
s5[2] += 3;
s5[3] += 4;
s5[4] += 5;
s7[0] = 10;
s7[1] = 20;
s7[2] = 30;
s7[3] = 40;
s7[4] = 50;
s7[5] = 60;
s7[6] = 70;
s6.sample(0);
s6.sample(1);
s6.sample(2);
s6.sample(3);
s6.sample(4);
s6.sample(5);
s6.sample(6);
s6.sample(7);
s6.sample(8);
s6.sample(9);
bin2.activate();
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(10);
s6.sample(11);
s6.sample(19);
s6.sample(20);
s6.sample(20);
s6.sample(21);
s6.sample(21);
s6.sample(31);
s6.sample(98);
s6.sample(99);
s6.sample(99);
s6.sample(99);
s7[0] = 700;
s7[1] = 600;
s7[2] = 500;
s7[3] = 400;
s7[4] = 300;
s7[5] = 200;
s7[6] = 100;
s9.sample(100);
s9.sample(100);
s9.sample(100);
s9.sample(100);
s9.sample(10);
s9.sample(10);
s9.sample(10);
s9.sample(10);
s9.sample(10);
curTick += 9;
s4 = curTick;
s6.sample(100);
s6.sample(100);
s6.sample(100);
s6.sample(101);
s6.sample(102);
s12.sample(100);
if (text) {
Text out(cout);
out.descriptions = descriptions;
out.compat = compat;
out();
}
if (!mysql_name.empty()) {
MySql out;
out.connect(mysql_host, mysql_user, mysql_passwd, "m5stats",
mysql_name, "test");
out();
}
return 0;
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream.h>
#include <string>
#include <vector>
#include "base/str.hh"
using namespace std;
int
main(int argc, char *argv[])
{
if (argc != 2) {
cout << "Usage: " << argv[0] << " <number>\n";
exit(1);
}
string s = argv[1];
#define OUTVAL(valtype, type) do { \
valtype value; \
cout << "TYPE = " #valtype "\n"; \
if (to_number(s, value)) { \
cout << "Number(" << s << ") = " << dec \
<< (unsigned long long)(unsigned type)value << "\n" \
<< "Number(" << s << ") = " << dec \
<< (signed long long)(signed type)value << "\n" \
<< "Number(" << s << ") = 0x" << hex \
<< (unsigned long long)(unsigned type)value << "\n" \
<< "Number(" << s << ") = 0" << oct \
<< (unsigned long long)(unsigned type)value << "\n\n"; \
} else \
cout << "Number(" << s << ") is invalid\n\n"; \
} while (0)
OUTVAL(signed long long, long long);
OUTVAL(unsigned long long, long long);
OUTVAL(signed long, long);
OUTVAL(unsigned long, long);
OUTVAL(signed int, int);
OUTVAL(unsigned int, int);
OUTVAL(signed short, short);
OUTVAL(unsigned short, short);
OUTVAL(signed char, char);
OUTVAL(unsigned char, char);
return 0;
}

77
src/unittest/symtest.cc Normal file
View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream.h>
#include "base/str.hh"
#include "base/loader/symtab.hh"
Tick curTick = 0;
void
usage(const char *progname)
{
cout << "Usage: " << progname << " <symbol file> <symbol>" << endl;
exit(1);
}
int
main(int argc, char *argv[])
{
SymbolTable symtab;
if (argc != 3)
usage(argv[0]);
if (!symtab.load(argv[1])) {
cout << "could not load symbol file: " << argv[1] << endl;
exit(1);
}
string symbol = argv[2];
Addr address;
if (!to_number(symbol, address)) {
if (!symtab.findAddress(symbol, address)) {
cout << "could not find symbol: " << symbol << endl;
exit(1);
}
cout << symbol << " -> " << "0x" << hex << address << endl;
} else {
if (!symtab.findSymbol(address, symbol)) {
cout << "could not find address: " << address << endl;
exit(1);
}
cout << "0x" << hex << address << " -> " << symbol<< endl;
}
return 0;
}

81
src/unittest/tokentest.cc Normal file
View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include <string>
#include <vector>
#include "base/str.hh"
int
main(int argc, char *argv[])
{
using namespace std;
if (argc != 3) {
cout << "Usage: " << argv[0] << " <string> <token>\n";
exit(1);
}
int i;
string test = argv[1];
vector<string> tokens1;
vector<string> tokens2;
char token = argv[2][0];
cout << "string = \"" << test << "\", token = \'" << token << "\'\n";
cout << "testing without ignore\n";
tokenize(tokens1, test, token, false);
if (tokens1.size()) {
int size = tokens1.size();
cout << "size = " << size << "\n";
for (i = 0; i < size; i++) {
cout << "'" << tokens1[i] << "' (" << tokens1[i].size()
<< ")" << ((i == size - 1) ? "\n" : ", ");
}
} else {
cout << "no tokens" << endl;
}
cout << "testing with ignore\n";
tokenize(tokens2, test, token, true);
if (tokens2.size()) {
int size = tokens2.size();
cout << "size = " << size << "\n";
for (i = 0; i < size; i++) {
cout << "'" << tokens2[i] << "' (" << tokens2[i].size()
<< ")" << ((i == size - 1) ? "\n" : ", ");
}
} else {
cout << "no tokens" << endl;
}
return 0;
}

54
src/unittest/tracetest.cc Normal file
View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sim/host.hh"
#include "base/trace.hh"
using namespace std;
Tick curTick = 0;
struct foo
{
foo()
{
char foo[9] = "testing";
DPRINTF(Loader, "%s\n", foo);
}
};
int
main()
{
Trace::flags[Trace::Loader] = true;
Trace::dprintf_stream = &cout;
foo f;
return 0;
}