sc_port.hh (13206:c944ef4abb48) sc_port.hh (13207:034ca389a810)
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

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

34
35#include "../utils/sc_report_handler.hh"
36#include "sc_module.hh" // for sc_gen_unique_name
37#include "sc_object.hh"
38
39namespace sc_gem5
40{
41
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

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

34
35#include "../utils/sc_report_handler.hh"
36#include "sc_module.hh" // for sc_gen_unique_name
37#include "sc_object.hh"
38
39namespace sc_gem5
40{
41
42class BindInfo;
43class Module;
44class StaticSensitivityPort;
45class StaticSensitivityFinder;
42class Port;
46
47};
48
49namespace sc_core
50{
51
52class sc_interface;
53
54enum sc_port_policy
55{
56 SC_ONE_OR_MORE_BOUND, // Default
57 SC_ZERO_OR_MORE_BOUND,
58 SC_ALL_BOUND
59};
60
61class sc_port_base : public sc_object
62{
63 public:
64 sc_port_base(const char *name, int n, sc_port_policy p);
43
44};
45
46namespace sc_core
47{
48
49class sc_interface;
50
51enum sc_port_policy
52{
53 SC_ONE_OR_MORE_BOUND, // Default
54 SC_ZERO_OR_MORE_BOUND,
55 SC_ALL_BOUND
56};
57
58class sc_port_base : public sc_object
59{
60 public:
61 sc_port_base(const char *name, int n, sc_port_policy p);
62 virtual ~sc_port_base();
65
66 void warn_unimpl(const char *func) const;
67
68 int maxSize() const;
69 int size() const;
70
71 const char *kind() const { return "sc_port_base"; }
72

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

82 virtual int vbind(sc_port_base &) = 0;
83
84 virtual void before_end_of_elaboration() = 0;
85 virtual void end_of_elaboration() = 0;
86 virtual void start_of_simulation() = 0;
87 virtual void end_of_simulation() = 0;
88
89 private:
63
64 void warn_unimpl(const char *func) const;
65
66 int maxSize() const;
67 int size() const;
68
69 const char *kind() const { return "sc_port_base"; }
70

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

80 virtual int vbind(sc_port_base &) = 0;
81
82 virtual void before_end_of_elaboration() = 0;
83 virtual void end_of_elaboration() = 0;
84 virtual void start_of_simulation() = 0;
85 virtual void end_of_simulation() = 0;
86
87 private:
90 friend class ::sc_gem5::StaticSensitivityPort;
91 friend class ::sc_gem5::StaticSensitivityFinder;
88 friend class ::sc_gem5::Port;
92 friend class ::sc_gem5::Kernel;
93
89 friend class ::sc_gem5::Kernel;
90
94 void _gem5Finalize();
95
96 virtual sc_interface *_gem5Interface(int n) const = 0;
97 virtual void _gem5AddInterface(sc_interface *i) = 0;
98
91 virtual sc_interface *_gem5Interface(int n) const = 0;
92 virtual void _gem5AddInterface(sc_interface *i) = 0;
93
99 std::vector<::sc_gem5::BindInfo *> _gem5BindInfo;
100 int _maxSize;
101 int _size;
102 bool finalized;
94 ::sc_gem5::Port *_gem5Port;
103};
104
105template <class IF>
106class sc_port_b : public sc_port_base
107{
108 public:
109 void operator () (IF &i) { bind(i); }
110 void operator () (sc_port_b<IF> &p) { bind(p); }

--- 159 unchanged lines hidden ---
95};
96
97template <class IF>
98class sc_port_b : public sc_port_base
99{
100 public:
101 void operator () (IF &i) { bind(i); }
102 void operator () (sc_port_b<IF> &p) { bind(p); }

--- 159 unchanged lines hidden ---