core.cc (4123:9c80390ea1bb) core.cc (4167:ce5d0f62f13b)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29 * Steve Reinhardt
30 */
31
32#include <iostream>
33#include <string>
34
35#include "base/callback.hh"
36#include "base/output.hh"
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29 * Steve Reinhardt
30 */
31
32#include <iostream>
33#include <string>
34
35#include "base/callback.hh"
36#include "base/output.hh"
37#include "sim/core.hh"
37
38using namespace std;
39
38
39using namespace std;
40
41Tick curTick = 0;
42
43namespace Clock {
44/// The simulated frequency of curTick. (In ticks per second)
45Tick Frequency;
46
47namespace Float {
48double s;
49double ms;
50double us;
51double ns;
52double ps;
53
54double Hz;
55double kHz;
56double MHz;
57double GHZ;
58/* namespace Float */ }
59
60namespace Int {
61Tick s;
62Tick ms;
63Tick us;
64Tick ns;
65Tick ps;
66/* namespace Float */ }
67
68/* namespace Clock */ }
69
40void
70void
71setClockFrequency(Tick ticksPerSecond)
72{
73 using namespace Clock;
74 Frequency = ticksPerSecond;
75 Float::s = static_cast<double>(Frequency);
76 Float::ms = Float::s / 1.0e3;
77 Float::us = Float::s / 1.0e6;
78 Float::ns = Float::s / 1.0e9;
79 Float::ps = Float::s / 1.0e12;
80
81 Float::Hz = 1.0 / Float::s;
82 Float::kHz = 1.0 / Float::ms;
83 Float::MHz = 1.0 / Float::us;
84 Float::GHZ = 1.0 / Float::ns;
85
86 Int::s = Frequency;
87 Int::ms = Int::s / 1000;
88 Int::us = Int::ms / 1000;
89 Int::ns = Int::us / 1000;
90 Int::ps = Int::ns / 1000;
91
92}
93
94void
41setOutputDir(const string &dir)
42{
43 simout.setDirectory(dir);
44}
45
95setOutputDir(const string &dir)
96{
97 simout.setDirectory(dir);
98}
99
100ostream *outputStream;
101ostream *configStream;
102
103void
104setOutputFile(const string &file)
105{
106 outputStream = simout.find(file);
107}
108
46/**
47 * Queue of C++ callbacks to invoke on simulator exit.
48 */
49inline CallbackQueue &
50exitCallbacks()
51{
52 static CallbackQueue theQueue;
53 return theQueue;

--- 15 unchanged lines hidden (view full) ---

69void
70doExitCleanup()
71{
72 exitCallbacks().process();
73 exitCallbacks().clear();
74
75 cout.flush();
76}
109/**
110 * Queue of C++ callbacks to invoke on simulator exit.
111 */
112inline CallbackQueue &
113exitCallbacks()
114{
115 static CallbackQueue theQueue;
116 return theQueue;

--- 15 unchanged lines hidden (view full) ---

132void
133doExitCleanup()
134{
135 exitCallbacks().process();
136 exitCallbacks().clear();
137
138 cout.flush();
139}
140