add system.mem_mode = ['timing', 'atomic']

update scripts acordingly

configs/test/SysPaths.py:
    new syspaths from nate, this one allows you to set script, binary, and disk paths like
    system.dir = 'aouaou' in your script
configs/test/fs.py:
    update for system mem_mode
    Put small checkpoint example
    Make clock 1THz
configs/test/test.py:
src/arch/alpha/freebsd/system.cc:
src/arch/alpha/linux/system.cc:
src/arch/alpha/system.cc:
src/arch/alpha/tru64/system.cc:
src/arch/sparc/system.cc:
src/python/m5/objects/System.py:
src/sim/system.cc:
src/sim/system.hh:
    update for system mem_mode
src/dev/io_device.cc:
    Use time returned from sendAtomic to delay

--HG--
extra : convert_revision : 67eedb3c84ab2584613faf88a534e793926fc92f
This commit is contained in:
Ali Saidi 2006-07-13 15:48:17 -04:00
parent 2bc9229ea7
commit c368ff0bd8
12 changed files with 82 additions and 33 deletions

View file

@ -2,41 +2,39 @@ import os, sys
from os.path import isdir, join as joinpath from os.path import isdir, join as joinpath
from os import environ as env from os import environ as env
systemdir = None def disk(file):
bindir = None system()
diskdir = None return joinpath(disk.dir, file)
scriptdir = None
def load_defaults(): def binary(file):
global systemdir, bindir, diskdir, scriptdir system()
if not systemdir: return joinpath(binary.dir, file)
def script(file):
system()
return joinpath(script.dir, file)
def system():
if not system.dir:
try: try:
path = env['M5_PATH'].split(':') path = env['M5_PATH'].split(':')
except KeyError: except KeyError:
path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ] path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
for systemdir in path: for system.dir in path:
if os.path.isdir(systemdir): if os.path.isdir(system.dir):
break break
else: else:
raise ImportError, "Can't find a path to system files." raise ImportError, "Can't find a path to system files."
if not bindir: if not binary.dir:
bindir = joinpath(systemdir, 'binaries') binary.dir = joinpath(system.dir, 'binaries')
if not diskdir: if not disk.dir:
diskdir = joinpath(systemdir, 'disks') disk.dir = joinpath(system.dir, 'disks')
if not scriptdir: if not script.dir:
scriptdir = joinpath(systemdir, 'boot') script.dir = joinpath(system.dir, 'boot')
def disk(file):
load_defaults()
return joinpath(diskdir, file)
def binary(file):
load_defaults()
return joinpath(bindir, file)
def script(file):
load_defaults()
return joinpath(scriptdir, file)
system.dir = None
binary.dir = None
disk.dir = None
script.dir = None

View file

@ -17,6 +17,8 @@ if args:
# Base for tests is directory containing this file. # Base for tests is directory containing this file.
test_base = os.path.dirname(__file__) test_base = os.path.dirname(__file__)
script.dir = '/z/saidi/work/m5.newmem/configs/boot'
linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img')) linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
class IdeControllerPciData(PciConfigData): class IdeControllerPciData(PciConfigData):
@ -187,6 +189,7 @@ class MyLinuxAlphaSystem(LinuxAlphaSystem):
intrctrl = IntrControl() intrctrl = IntrControl()
if options.timing: if options.timing:
cpu = TimingSimpleCPU() cpu = TimingSimpleCPU()
mem_mode = 'timing'
else: else:
cpu = AtomicSimpleCPU() cpu = AtomicSimpleCPU()
cpu.mem = magicbus2 cpu.mem = magicbus2
@ -194,6 +197,7 @@ class MyLinuxAlphaSystem(LinuxAlphaSystem):
cpu.dcache_port = magicbus2.port cpu.dcache_port = magicbus2.port
cpu.itb = AlphaITB() cpu.itb = AlphaITB()
cpu.dtb = AlphaDTB() cpu.dtb = AlphaDTB()
cpu.clock = '2GHz'
sim_console = SimConsole(listener=ConsoleListener(port=3456)) sim_console = SimConsole(listener=ConsoleListener(port=3456))
kernel = binary('vmlinux') kernel = binary('vmlinux')
pal = binary('ts_osfpal') pal = binary('ts_osfpal')
@ -216,7 +220,7 @@ def DualRoot(clientSystem, serverSystem):
self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0], self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0],
int2 = Parent.server.tsunami.etherint[0], int2 = Parent.server.tsunami.etherint[0],
dump = Parent.etherdump) dump = Parent.etherdump)
self.clock = '5GHz' self.clock = '1THz'
return self return self
root = DualRoot( root = DualRoot(
@ -225,6 +229,14 @@ root = DualRoot(
m5.instantiate(root) m5.instantiate(root)
#exit_event = m5.simulate(2600000000000)
#if exit_event.getCause() != "user interrupt received":
# m5.checkpoint(root, 'cpt')
# exit_event = m5.simulate(300000000000)
# if exit_event.getCause() != "user interrupt received":
# m5.checkpoint(root, 'cptA')
exit_event = m5.simulate() exit_event = m5.simulate()
print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause() print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()

View file

@ -79,6 +79,11 @@ cpu.icache_port=magicbus.port
cpu.dcache_port=magicbus.port cpu.dcache_port=magicbus.port
system = System(physmem = mem, cpu = cpu) system = System(physmem = mem, cpu = cpu)
if options.timing or options.detailed:
system.mem_mode = 'timing'
mem.port = magicbus.port mem.port = magicbus.port
root = Root(system = system) root = Root(system = system)

View file

@ -97,6 +97,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
Param<Tick> boot_cpu_frequency; Param<Tick> boot_cpu_frequency;
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
Param<string> kernel; Param<string> kernel;
Param<string> console; Param<string> console;
@ -115,6 +116,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
INIT_PARAM(physmem, "phsyical memory"), INIT_PARAM(physmem, "phsyical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings),
INIT_PARAM(kernel, "file that contains the kernel code"), INIT_PARAM(kernel, "file that contains the kernel code"),
INIT_PARAM(console, "file that contains the console code"), INIT_PARAM(console, "file that contains the console code"),
INIT_PARAM(pal, "file that contains palcode"), INIT_PARAM(pal, "file that contains palcode"),
@ -133,6 +136,7 @@ CREATE_SIM_OBJECT(FreebsdAlphaSystem)
p->name = getInstanceName(); p->name = getInstanceName();
p->boot_cpu_frequency = boot_cpu_frequency; p->boot_cpu_frequency = boot_cpu_frequency;
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
p->kernel_path = kernel; p->kernel_path = kernel;
p->console_path = console; p->console_path = console;
p->palcode = pal; p->palcode = pal;

View file

@ -191,6 +191,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
Param<Tick> boot_cpu_frequency; Param<Tick> boot_cpu_frequency;
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
Param<string> kernel; Param<string> kernel;
Param<string> console; Param<string> console;
@ -209,6 +210,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
INIT_PARAM(physmem, "phsyical memory"), INIT_PARAM(physmem, "phsyical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings),
INIT_PARAM(kernel, "file that contains the kernel code"), INIT_PARAM(kernel, "file that contains the kernel code"),
INIT_PARAM(console, "file that contains the console code"), INIT_PARAM(console, "file that contains the console code"),
INIT_PARAM(pal, "file that contains palcode"), INIT_PARAM(pal, "file that contains palcode"),
@ -227,6 +230,7 @@ CREATE_SIM_OBJECT(LinuxAlphaSystem)
p->name = getInstanceName(); p->name = getInstanceName();
p->boot_cpu_frequency = boot_cpu_frequency; p->boot_cpu_frequency = boot_cpu_frequency;
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
p->kernel_path = kernel; p->kernel_path = kernel;
p->console_path = console; p->console_path = console;
p->palcode = pal; p->palcode = pal;

View file

@ -221,6 +221,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
Param<Tick> boot_cpu_frequency; Param<Tick> boot_cpu_frequency;
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
Param<std::string> kernel; Param<std::string> kernel;
Param<std::string> console; Param<std::string> console;
@ -239,6 +240,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
INIT_PARAM(physmem, "phsyical memory"), INIT_PARAM(physmem, "phsyical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings),
INIT_PARAM(kernel, "file that contains the kernel code"), INIT_PARAM(kernel, "file that contains the kernel code"),
INIT_PARAM(console, "file that contains the console code"), INIT_PARAM(console, "file that contains the console code"),
INIT_PARAM(pal, "file that contains palcode"), INIT_PARAM(pal, "file that contains palcode"),
@ -257,6 +260,7 @@ CREATE_SIM_OBJECT(AlphaSystem)
p->name = getInstanceName(); p->name = getInstanceName();
p->boot_cpu_frequency = boot_cpu_frequency; p->boot_cpu_frequency = boot_cpu_frequency;
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
p->kernel_path = kernel; p->kernel_path = kernel;
p->console_path = console; p->console_path = console;
p->palcode = pal; p->palcode = pal;

View file

@ -95,6 +95,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
Param<Tick> boot_cpu_frequency; Param<Tick> boot_cpu_frequency;
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
Param<string> kernel; Param<string> kernel;
Param<string> console; Param<string> console;
@ -113,6 +114,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
INIT_PARAM(boot_cpu_frequency, "frequency of the boot cpu"), INIT_PARAM(boot_cpu_frequency, "frequency of the boot cpu"),
INIT_PARAM(physmem, "phsyical memory"), INIT_PARAM(physmem, "phsyical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings),
INIT_PARAM(kernel, "file that contains the kernel code"), INIT_PARAM(kernel, "file that contains the kernel code"),
INIT_PARAM(console, "file that contains the console code"), INIT_PARAM(console, "file that contains the console code"),
INIT_PARAM(pal, "file that contains palcode"), INIT_PARAM(pal, "file that contains palcode"),
@ -131,6 +134,7 @@ CREATE_SIM_OBJECT(Tru64AlphaSystem)
p->name = getInstanceName(); p->name = getInstanceName();
p->boot_cpu_frequency = boot_cpu_frequency; p->boot_cpu_frequency = boot_cpu_frequency;
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
p->kernel_path = kernel; p->kernel_path = kernel;
p->console_path = console; p->console_path = console;
p->palcode = pal; p->palcode = pal;

View file

@ -141,6 +141,7 @@ SparcSystem::unserialize(Checkpoint *cp, const std::string &section)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(SparcSystem) BEGIN_DECLARE_SIM_OBJECT_PARAMS(SparcSystem)
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
Param<std::string> kernel; Param<std::string> kernel;
Param<std::string> reset_bin; Param<std::string> reset_bin;
@ -161,6 +162,8 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(SparcSystem)
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"), INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
INIT_PARAM(physmem, "phsyical memory"), INIT_PARAM(physmem, "phsyical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings),
INIT_PARAM(kernel, "file that contains the kernel code"), INIT_PARAM(kernel, "file that contains the kernel code"),
INIT_PARAM(reset_bin, "file that contains the reset code"), INIT_PARAM(reset_bin, "file that contains the reset code"),
INIT_PARAM(hypervisor_bin, "file that contains the hypervisor code"), INIT_PARAM(hypervisor_bin, "file that contains the hypervisor code"),
@ -183,6 +186,7 @@ CREATE_SIM_OBJECT(SparcSystem)
p->name = getInstanceName(); p->name = getInstanceName();
p->boot_cpu_frequency = boot_cpu_frequency; p->boot_cpu_frequency = boot_cpu_frequency;
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
p->kernel_path = kernel; p->kernel_path = kernel;
p->reset_bin = reset_bin; p->reset_bin = reset_bin;
p->hypervisor_bin = hypervisor_bin; p->hypervisor_bin = hypervisor_bin;

View file

@ -287,6 +287,7 @@ DmaPort::sendDma(Packet *pkt, bool front)
// some kind of selction between access methods // some kind of selction between access methods
// more work is going to have to be done to make // more work is going to have to be done to make
// switching actually work // switching actually work
System::MemoryMode state = sys->getMemoryMode(); System::MemoryMode state = sys->getMemoryMode();
if (state == System::Timing) { if (state == System::Timing) {
DPRINTF(DMA, "Attempting to send Packet %#x with addr: %#x\n", DPRINTF(DMA, "Attempting to send Packet %#x with addr: %#x\n",
@ -301,15 +302,15 @@ DmaPort::sendDma(Packet *pkt, bool front)
DPRINTF(DMA, "-- Done\n"); DPRINTF(DMA, "-- Done\n");
} }
} else if (state == System::Atomic) { } else if (state == System::Atomic) {
sendAtomic(pkt); Tick lat;
lat = sendAtomic(pkt);
assert(pkt->senderState); assert(pkt->senderState);
DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState); DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState);
assert(state); assert(state);
state->numBytes += pkt->req->getSize(); state->numBytes += pkt->req->getSize();
if (state->totBytes == state->numBytes) { if (state->totBytes == state->numBytes) {
state->completionEvent->schedule(curTick + state->completionEvent->schedule(curTick + lat);
(pkt->time - pkt->req->getTime()) +1);
delete state; delete state;
delete pkt->req; delete pkt->req;
} }

View file

@ -1,9 +1,12 @@
from m5 import build_env from m5 import build_env
from m5.config import * from m5.config import *
class MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing']
class System(SimObject): class System(SimObject):
type = 'System' type = 'System'
physmem = Param.PhysicalMemory(Parent.any, "phsyical memory") physmem = Param.PhysicalMemory(Parent.any, "phsyical memory")
mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
if build_env['FULL_SYSTEM']: if build_env['FULL_SYSTEM']:
boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency, boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
"boot processor frequency") "boot processor frequency")

View file

@ -63,7 +63,7 @@ System::System(Params *p)
#else #else
page_ptr(0), page_ptr(0),
#endif #endif
_params(p) memoryMode(p->mem_mode), _params(p)
{ {
// add self to global system list // add self to global system list
systemList.push_back(this); systemList.push_back(this);
@ -257,6 +257,9 @@ printSystems()
System::printSystems(); System::printSystems();
} }
const char *System::MemoryModeStrings[3] = {"invalid", "atomic",
"timing"};
#if FULL_SYSTEM #if FULL_SYSTEM
// In full system mode, only derived classes (e.g. AlphaLinuxSystem) // In full system mode, only derived classes (e.g. AlphaLinuxSystem)
@ -269,12 +272,15 @@ DEFINE_SIM_OBJECT_CLASS_NAME("System", System)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(System) BEGIN_DECLARE_SIM_OBJECT_PARAMS(System)
SimObjectParam<PhysicalMemory *> physmem; SimObjectParam<PhysicalMemory *> physmem;
SimpleEnumParam<System::MemoryMode> mem_mode;
END_DECLARE_SIM_OBJECT_PARAMS(System) END_DECLARE_SIM_OBJECT_PARAMS(System)
BEGIN_INIT_SIM_OBJECT_PARAMS(System) BEGIN_INIT_SIM_OBJECT_PARAMS(System)
INIT_PARAM(physmem, "physical memory") INIT_PARAM(physmem, "physical memory"),
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
System::MemoryModeStrings)
END_INIT_SIM_OBJECT_PARAMS(System) END_INIT_SIM_OBJECT_PARAMS(System)
@ -283,6 +289,7 @@ CREATE_SIM_OBJECT(System)
System::Params *p = new System::Params; System::Params *p = new System::Params;
p->name = getInstanceName(); p->name = getInstanceName();
p->physmem = physmem; p->physmem = physmem;
p->mem_mode = mem_mode;
return new System(p); return new System(p);
} }

View file

@ -67,6 +67,8 @@ class System : public SimObject
Timing Timing
}; };
static const char *MemoryModeStrings[3];
MemoryMode getMemoryMode() { assert(memoryMode); return memoryMode; } MemoryMode getMemoryMode() { assert(memoryMode); return memoryMode; }
@ -170,6 +172,7 @@ class System : public SimObject
{ {
std::string name; std::string name;
PhysicalMemory *physmem; PhysicalMemory *physmem;
MemoryMode mem_mode;
#if FULL_SYSTEM #if FULL_SYSTEM
Tick boot_cpu_frequency; Tick boot_cpu_frequency;