kernel.hh (12953:ddfd5e4643a9) kernel.hh (12982:c7966254372e)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

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

27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_KERNEL_HH__
31#define __SYSTEMC_KERNEL_HH__
32
33#include "params/SystemC_Kernel.hh"
34#include "sim/sim_object.hh"
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

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

27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_KERNEL_HH__
31#define __SYSTEMC_KERNEL_HH__
32
33#include "params/SystemC_Kernel.hh"
34#include "sim/sim_object.hh"
35#include "systemc/ext/core/sc_main.hh"
35
36
36namespace SystemC
37namespace sc_gem5
37{
38
39/*
40 * This class represents the systemc kernel. There should be exactly one in
41 * the simulation. It receives gem5 SimObject lifecycle callbacks (init,
42 * regStats, etc.) and manages the lifecycle of the systemc simulation
43 * accordingly. It also acts as a collecting point for systemc related
44 * control functionality.
45 */
46class Kernel : public SimObject
47{
48 public:
49 typedef SystemC_KernelParams Params;
50 Kernel(Params *params);
51
38{
39
40/*
41 * This class represents the systemc kernel. There should be exactly one in
42 * the simulation. It receives gem5 SimObject lifecycle callbacks (init,
43 * regStats, etc.) and manages the lifecycle of the systemc simulation
44 * accordingly. It also acts as a collecting point for systemc related
45 * control functionality.
46 */
47class Kernel : public SimObject
48{
49 public:
50 typedef SystemC_KernelParams Params;
51 Kernel(Params *params);
52
53 void init() override;
54 void regStats() override;
52 void startup() override;
53
54 void t0Handler();
55
55 void startup() override;
56
57 void t0Handler();
58
59 sc_core::sc_status status() { return _status; }
60 void status(sc_core::sc_status s) { _status = s; }
61
62 void stop();
63
64 bool startOfSimulationComplete() { return _startComplete; }
65 bool endOfSimulationComplete() { return _endComplete; }
66
56 private:
67 private:
68 bool _stopAfterCallbacks;
69 void stopWork();
70
71 bool _startComplete;
72 bool _endComplete;
73 sc_core::sc_status _status;
74
57 EventWrapper<Kernel, &Kernel::t0Handler> t0Event;
58};
59
75 EventWrapper<Kernel, &Kernel::t0Handler> t0Event;
76};
77
60} // namespace SystemC
78extern Kernel *kernel;
61
79
80} // namespace sc_gem5
81
62#endif // __SYSTEMC_KERNEL_H__
82#endif // __SYSTEMC_KERNEL_H__