From 43a9caa2214faffaa1fd5ce1730063f9959a8ce8 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 29 Mar 2005 07:55:44 -0500 Subject: expose variables for number of global events per simulated second, millisecond, microsecond, etc. so that the user can explicitly convert between system ticks and time and know what sorts of expensive operations are being used for that conversion. arch/alpha/alpha_tru64_process.cc: arch/alpha/pseudo_inst.cc: dev/etherdump.cc: dev/etherlink.cc: dev/ns_gige.cc: dev/sinic.cc: dev/tsunami_io.cc: dev/uart.cc: sim/stat_control.cc: sim/syscall_emul.hh: Use the new variables for getting the event clock dev/etherdump.hh: delete variables that are no longer needed. --HG-- extra : convert_revision : d95fc7d44909443e1b7952a24ef822ef051c7cf2 --- sim/universe.cc | 69 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 15 deletions(-) (limited to 'sim/universe.cc') diff --git a/sim/universe.cc b/sim/universe.cc index 9137baaf0..8419e1fe4 100644 --- a/sim/universe.cc +++ b/sim/universe.cc @@ -42,16 +42,41 @@ using namespace std; Tick curTick = 0; -Tick ticksPerSecond; -double __ticksPerMS; -double __ticksPerUS; -double __ticksPerNS; -double __ticksPerPS; - bool fullSystem; ostream *outputStream; ostream *configStream; +/// The simulated frequency of curTick. (This is only here for a short time) +Tick ticksPerSecond; + +namespace Clock { +/// The simulated frequency of curTick. (In ticks per second) +Tick Frequency; + +namespace Float { +double s; +double ms; +double us; +double ns; +double ps; + +double Hz; +double kHz; +double MHz; +double GHZ; +/* namespace Float */ } + +namespace Int { +Tick s; +Tick ms; +Tick us; +Tick ns; +Tick ps; +/* namespace Float */ } + +/* namespace Clock */ } + + // Dummy Object class Root : public SimObject { @@ -92,17 +117,31 @@ CREATE_SIM_OBJECT(Root) panic("FULL_SYSTEM not compiled but configuration is full_system"); #endif - ticksPerSecond = frequency; - double freq = double(ticksPerSecond); - __ticksPerMS = freq / 1.0e3; - __ticksPerUS = freq / 1.0e6; - __ticksPerNS = freq / 1.0e9; - __ticksPerPS = freq / 1.0e12; - outputStream = simout.find(output_file); + Root *root = new Root(getInstanceName()); - return new Root(getInstanceName()); + ticksPerSecond = frequency; + + using namespace Clock; + Frequency = frequency; + Float::s = static_cast(Frequency); + Float::ms = Float::s / 1.0e3; + Float::us = Float::s / 1.0e6; + Float::ns = Float::s / 1.0e9; + Float::ps = Float::s / 1.0e12; + + Float::Hz = 1.0 / Float::s; + Float::kHz = 1.0 / Float::ms; + Float::MHz = 1.0 / Float::us; + Float::GHZ = 1.0 / Float::ns; + + Int::s = Frequency; + Int::ms = Int::s / 1000; + Int::us = Int::ms / 1000; + Int::ns = Int::us / 1000; + Int::ps = Int::ns / 1000; + + return root; } REGISTER_SIM_OBJECT("Root", Root) - -- cgit v1.2.3 From c82562c7404287e22c4e83c45fa563fba0a14b0a Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 6 Apr 2005 16:58:40 -0400 Subject: full_system isn't a useful parameter anymore, get rid of it. python/m5/objects/Root.mpy: sim/universe.cc: util/stats/stats.py: full_system isn't a useful parameter --HG-- extra : convert_revision : 557091be1faa3cf121c55102aba4e6f4c1bd45ef --- sim/universe.cc | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'sim/universe.cc') diff --git a/sim/universe.cc b/sim/universe.cc index 8419e1fe4..5ae41eefd 100644 --- a/sim/universe.cc +++ b/sim/universe.cc @@ -42,7 +42,6 @@ using namespace std; Tick curTick = 0; -bool fullSystem; ostream *outputStream; ostream *configStream; @@ -86,7 +85,6 @@ class Root : public SimObject BEGIN_DECLARE_SIM_OBJECT_PARAMS(Root) - Param full_system; Param frequency; Param output_file; @@ -94,7 +92,6 @@ END_DECLARE_SIM_OBJECT_PARAMS(Root) BEGIN_INIT_SIM_OBJECT_PARAMS(Root) - INIT_PARAM(full_system, "full system simulation"), INIT_PARAM(frequency, "tick frequency"), INIT_PARAM(output_file, "file to dump simulator output to") @@ -107,15 +104,6 @@ CREATE_SIM_OBJECT(Root) panic("only one root object allowed!"); created = true; - fullSystem = full_system; - -#ifdef FULL_SYSTEM - if (!fullSystem) - panic("FULL_SYSTEM compiled and configuration not full_system"); -#else - if (fullSystem) - panic("FULL_SYSTEM not compiled but configuration is full_system"); -#endif outputStream = simout.find(output_file); Root *root = new Root(getInstanceName()); -- cgit v1.2.3