From 6bcc65c1f866348f64a804a8bcc1f6dc06145afa Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Tue, 11 Jul 2006 15:42:31 -0400 Subject: [PATCH 1/4] Fix ordering issue with squashed Icache Fetches and Static data in packet. Now hello world works with 2 levels of cache with O3 CPU(multiple outstanding requests). src/cpu/o3/fetch_impl.hh: Fix ordering issue with squashed Icache Fetches and Static data in packet. --HG-- extra : convert_revision : a6adb87540b007ead0b4982cb3f31da8199fb5ca --- src/cpu/o3/fetch_impl.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index de883b5ba..39a13f9f8 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -357,6 +357,8 @@ DefaultFetch::processCacheCompletion(PacketPtr pkt) return; } + memcpy(cacheData[tid], pkt->getPtr(), cacheBlkSize); + if (!drainPending) { // Wake up the CPU (if it went to sleep and was waiting on // this completion event). @@ -548,7 +550,7 @@ DefaultFetch::fetchCacheLine(Addr fetch_PC, Fault &ret_fault, unsigned tid // Build packet here. PacketPtr data_pkt = new Packet(mem_req, Packet::ReadReq, Packet::Broadcast); - data_pkt->dataStatic(cacheData[tid]); + data_pkt->dataDynamic(new uint8_t[cacheBlkSize]); DPRINTF(Fetch, "Fetch: Doing instruction read.\n"); From 3218538740a6132273875f84ce0cb95a2c79a62d Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 12 Jul 2006 15:18:49 -0400 Subject: [PATCH 3/4] Fix __file__ for scripts src/python/m5/main.py: set __file__ to the script, not the m5 binary. --HG-- extra : convert_revision : a0bbd059d2fd321ae8ff68225abc8a7bb5c410ed --- src/python/m5/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/m5/main.py b/src/python/m5/main.py index 904b241ca..80dbcb5aa 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -283,9 +283,10 @@ def main(): objects.ExecutionTrace.print_fetchseq = options.print_fetch_seq objects.ExecutionTrace.print_cpseq = options.print_cpseq - scope = { '__file__' : sys.argv[0] } sys.argv = arguments sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path + + scope = { '__file__' : sys.argv[0] } exec("import readline", scope) execfile(sys.argv[0], scope) From bf4fdbe25a275eeb036cd5e9e05d126c52f90aba Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 12 Jul 2006 15:21:23 -0400 Subject: [PATCH 4/4] Add --pdb src/python/m5/main.py: Add a command line option to invoke pdb on your script --HG-- extra : convert_revision : ef5a2860bd3f6e479fa80eccaae0cb5541a20b50 --- src/python/m5/main.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/python/m5/main.py b/src/python/m5/main.py index 80dbcb5aa..54c54c1d5 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -119,6 +119,8 @@ add_option('-d', "--outdir", metavar="DIR", default=".", help="Set the output directory to DIR [Default: %default]") add_option('-i', "--interactive", action="store_true", default=False, help="Invoke the interactive interpreter after running the script") +add_option("--pdb", action="store_true", default=False, + help="Invoke the python debugger before running the script") add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', help="Prepend PATH to the system path when invoking the script") add_option('-q', "--quiet", action="count", default=0, @@ -287,8 +289,19 @@ def main(): sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path scope = { '__file__' : sys.argv[0] } - exec("import readline", scope) - execfile(sys.argv[0], scope) + + # we want readline if we're doing anything interactive + if options.interactive or options.pdb: + exec("import readline", scope) + + # if pdb was requested, execfile the thing under pdb, otherwise, + # just do the execfile normally + if options.pdb: + from pdb import Pdb + debugger = Pdb() + debugger.run('execfile("%s")' % sys.argv[0], scope) + else: + execfile(sys.argv[0], scope) # once the script is done if options.interactive: